Class
NumCosmoMathStatsAcorr
Description [src]
final class NumCosmoMath.StatsAcorr : GObject.Object
{
/* No available fields */
}
Integrated autocorrelation time $\tau$ of one or more scalar series, updated one sample at a time.
For each series the object accumulates the lagged autocovariances $C_k$ up to
NcmStatsAcorr:max-lag, and repeats that accumulation on successive levels of block
averages, level $j$ seeing the means of $2^j$ consecutive samples. Each update costs
$O(\mathrm{max\text{-}lag})$ per series and the stored state is
$O(\mathrm{max\text{-}lag}\log n)$: the samples are not retained. The accumulated $C_k$
are exact, in the sense that feeding a series one sample at a time and computing its
autocovariances in one pass over the whole series give the same numbers to rounding.
Three estimators turn $C_k$ into $\tau$: an auto-regressive spectral estimate with the
order chosen by NcmStatsAcorr:ar-criterion, Geyer’s initial monotone positive sequence,
and Sokal’s self-consistent window, selected by NcmStatsAcorr:method. They are pure functions of
$C_k$, and NCM_STATS_ACORR_METHOD_MAX reports the largest and flags a disagreement. The
level whose blocks resolve the correlation within the available lags is selected
automatically, which is what removes the ceiling a fixed maximum lag would otherwise put
on $\tau$. Every estimate carries a NcmStatsAcorrDiag saying whether it is to be trusted.
Error modes: a series with no variance never moved, so its correlation time is unbounded
and $\tau$ is reported at its cap, the number of samples, with
NCM_STATS_ACORR_DIAG_ZERO_VARIANCE, which makes the effective sample size one; an
estimator whose truncated sum is not positive gives $\tau = 1$; $\tau$ is capped at the
number of samples, since a longer correlation is not measurable from the series. None of
these abort.
The drift and variance-shift conditions compare the two halves of the block values of the
coarsest level holding at least 16 of them, as far as the first NcmStatsAcorr:max-lag of
those values. They cover the whole series while that level holds at most
NcmStatsAcorr:max-lag values, which with the default lags and levels is up to
$2^{23}\times 512 \approx 4\times 10^9$ samples; with a smaller NcmStatsAcorr:max-levels
they may cover only the start of the series.
See Autocorrelation Time and Effective Sample Size for the definitions, the identity the accumulator updates, the level-selection rule and the meaning of each condition.
Constructors
ncm_stats_acorr_new
Creates a new NcmStatsAcorr tracking len series with the default lag budget and estimator.
Functions
ncm_stats_acorr_acov_fft
Centered autocovariances of series computed by zero-padded Fourier transform,
normalized by the number of samples. This is the $O(n\log n)$ path used when a whole
series is available at once; the accumulator computes the same numbers one sample at
a time.
ncm_stats_acorr_ar_fit
Fits an auto-regressive model to acov and returns what the fit is made of, rather than
the $\tau$ that ncm_stats_acorr_tau_ar() builds from it. phi holds
$\phi_{p,1} \dots \phi_{p,p}$ and pacf the reflection coefficients $\kappa_m$, whose
decay with $m$ is what an order-selection rule is reading.
ncm_stats_acorr_tau_ar
Integrated autocorrelation time from an auto-regressive fit of acov by the
Levinson-Durbin recursion, the order chosen by crit, as $\tau = S(0) / C_0$ with $S(0)$
the spectral density of the fitted model at zero frequency. See
Autocorrelation Time and Effective Sample
Size.
ncm_stats_acorr_tau_geyer
Integrated autocorrelation time of acov by Geyer’s initial monotone positive
sequence: the lag pairs $\Gamma_k = C_{2k} + C_{2k+1}$ are summed while they stay
positive, after being made non-increasing.
ncm_stats_acorr_tau_sokal
Integrated autocorrelation time of acov summed up to the smallest window $M$
satisfying $M \geq c\,\tau(M)$. If no window satisfies it the whole sequence is summed.
Instance methods
ncm_stats_acorr_get_acov
Autocovariances of series p at level level, $C_0 \dots C_L$ with
$L = \min(\mathrm{max\text{-}lag}, n_\mathrm{level}-1)$, normalized by the number of
block values of that level. Aborts if the level holds fewer than two values.
ncm_stats_acorr_get_ar_fit
Auto-regressive fit of series p at the level its estimate was taken from, returning
what the fit is made of rather than the $\tau$ built from it. See
ncm_stats_acorr_ar_fit(). Aborts if series p has fewer than two samples.
ncm_stats_acorr_get_drift_z
Difference between the mean of the first and of the second half of series p, in
units of the standard error of that difference.
ncm_stats_acorr_get_spec0
Long-run variance $S(0) = \tau\,\mathrm{Var}(x)$ of series p: the spectral density
at zero frequency, which is what the variance of the mean is built from.
ncm_stats_acorr_get_tau
Integrated autocorrelation time of series p, in samples, by the estimator set in
NcmStatsAcorr:method. Check ncm_stats_acorr_get_diag() before using it.
ncm_stats_acorr_get_tau_method
Integrated autocorrelation time of series p by method, at the level selected for
NcmStatsAcorr:method. Lets one estimator be compared with another without changing
the object’s configuration. A series with no variance gives the cap, the number of
samples, as ncm_stats_acorr_get_tau() does.
ncm_stats_acorr_get_var_mean
Variance of the sample mean of series p, $S(0)/n$. No assumption is made about the
samples beyond the series itself being the one averaged.
ncm_stats_acorr_get_var_ratio
Variance of the second half of series p divided by the variance of the first half,
both taken over the block values of the coarsest level holding enough of them. One
when there are too few.
ncm_stats_acorr_set_ar_criterion
Sets the rule that picks the order of the auto-regressive fit. The accumulated autocovariances are unaffected, so it can be changed at any time.
ncm_stats_acorr_set_method
Sets the estimator. The accumulated autocovariances are unaffected, so the estimate can be changed at any time.
ncm_stats_acorr_set_series_matrix
Discards everything accumulated and feeds every row of series in order.
ncm_stats_acorr_update
Adds one sample of each series. Costs $O(\mathrm{max\text{-}lag})$ per series.
Properties
NumCosmoMath.StatsAcorr:drift-threshold
Number of standard errors between the means of the first and of the second half of
the series above which NCM_STATS_ACORR_DIAG_DRIFT is set.
NumCosmoMath.StatsAcorr:max-lag
Number of lags accumulated at each level. It bounds the correlation each level can resolve, not the reported $\tau$: a correlation longer than that is resolved at a coarser level.
NumCosmoMath.StatsAcorr:max-levels
Maximum number of block-averaging levels. Level $j$ averages $2^j$ consecutive samples, so the longest resolvable $\tau$ is of order $2^{\mathrm{max\text{-}levels}-1}\,\mathrm{max\text{-}lag}$.
NumCosmoMath.StatsAcorr:reliability-factor
A series shorter than this many autocorrelation times gets
NCM_STATS_ACORR_DIAG_SHORT_CHAIN.
Signals
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.