pyhctsa.robust.bf_residual_stats

pyhctsa.robust.bf_residual_stats(res, y)

Statistics of the residuals of a fit, for remaining structure (hctsa BF_ResidualStats).

The autocorrelation of the residuals at lags 1 and 2 (the Fourier method of CO_AutoCorr) and a runs test (bf_runs_z()). The residuals are taken in the order given.

All three outputs are NaN if the residuals have no variation beyond floating-point round-off, as for an exact fit: the autocorrelation and runs of round-off are not meaningful (and differ between implementations). The criterion is a standard deviation of the residuals of at most 10 * N * eps times the root-mean-square of the fitted data (N values), a bound on the rounding error of a fit to them: a fitted value accumulates rounding over sums of up to N terms (at most about N * eps / 2 of the magnitude of the data), and a sinusoid evaluated at times up to N has a phase rounding error of up to about 1.5 * pi * N * eps (see pyhctsa.operations.pre_process.preproc_compare()). Small but genuine residuals, such as the quantization noise left by an exact fit to 24-bit data, are computed.

Parameters:
res : array-like

The residuals.

y : array-like

The fitted data, whose magnitude sets the round-off scale.

Returns:

(ac1, ac2, runsz).

Return type:

tuple of float