polars_online.corr.fisher_se¶
- polars_online.corr.fisher_se(n: float, rho: float | None = None, phi_a: float | None = None, phi_b: float | None = None) float[source]¶
Compute the standard error of a correlation’s Fisher
z, or of the correlation itself.Use it to judge whether a correlation differs from another, or from 0, by more than its sampling error, on Fisher’s
zscale or on the correlation’s own. Give the two series’ AR(1) coefficients to widen it for autocorrelated series.Parameters
nThe number of observations the correlation is estimated from.
rhoDefault
None, the standard error of Fisher’sz. Given, the delta-method error of the correlationrhoitself, from -1 to 1.phi_a,phi_bThe two series’ AR(1) coefficients, given together or not at all. Given, the error is inflated for the pair’s autocorrelation (Notes).
Returns
A float:
se = 1 / sqrt(n - 3) # of z * (1 - rho**2) # with rho * sqrt((1 + phi_a phi_b) / (1 - phi_a phi_b)) # with both phi
It is
nanatn <= 3.Raises
ValueErrorA
rhooutside[-1, 1], onephiwithout the other, since the inflation is a property of the pair, orphi_a * phi_boutside(-1, 1), at anyn.
Examples
print(round(po.corr.fisher_se(103), 4), round(po.corr.fisher_se(103, rho=0.5), 4), round(po.corr.fisher_se(103, phi_a=0.5, phi_b=0.5), 4))
0.1 0.075 0.1291
See also
to_z(), thezthis is the error of.signal_share(), the same sampling error against a correlation’s movement across blocks.
Notes
The AR(1) inflation follows from Bartlett’s formula,
Var(r) ~ (1/n) sum_k rho_a(k) rho_b(k), and the geometric series1 + 2 sum_{k>=1} (phi_a phi_b)**k. It holds under a true cross-correlation of 0 and linear dependence. It is not valid under ARCH-type innovations, where the variance of a sample correlation depends on the fourth moments and this understates it.