statsmodels.tsa.stattools.block_jackknife#

statsmodels.tsa.stattools.block_jackknife(x, statistic, n_blocks=-1)[source]#

Delete-k (block) jackknife estimate of bias and standard error

Computes the jackknife point estimate and standard error of a statistic by systematically leaving out contiguous blocks of the sample and recomputing the statistic, generalizing the classical delete-1 jackknife to allow for serial dependence in the data.

Parameters:
xarray_like

The data series, 1-D.

statisticcallable

Function that takes an array and returns a scalar or array-valued estimate.

n_blocksint

The number of blocks to use. If -1 (default), uses n_blocks = len(x), i.e., the classical delete-1 jackknife.

Returns:
JackknifeResult

A NamedTuple with fields:

theta_jackfloat or ndarray

The bias-corrected jackknife point estimate.

sefloat or ndarray

The jackknife standard error estimate.

Notes

For data with serial dependence, n_blocks should be chosen small enough (equivalently, block size large enough) that observations in different blocks are approximately uncorrelated; this is a modeling choice left to the user and is not verified automatically.

This implementation performs single-order bias correction only. A known residual bias of order O(1/n^2) remains uncorrected; an iterated jackknife (Schucany, Gray & Owen 1971) would address this at added computational cost. Additionally, non-overlapping block placement introduces some sensitivity to the arbitrary choice of block boundaries; overlapping/moving-block schemes (Kunsch 1989) would reduce this. Both are natural extensions but out of scope here.

To avoid O(n_blocks * n) cumulative memory allocation, a single internal buffer is allocated once and reused across all delete-block computations. As a result, statistic must not modify the array it receives in place; doing so will silently corrupt results in later iterations.

References

[1]

Quenouille, M.H. (1949). “Approximate tests of correlation in time-series.” Journal of the Royal Statistical Society, Series B, 11: 68-84.

[2]

Tukey, J.W. (1958). “Bias and confidence in not-quite large samples.” Annals of Mathematical Statistics, 29: 614.

[3]

Kunsch, H.R. (1989). “The jackknife and the bootstrap for general stationary observations.” Annals of Statistics, 17: 1217-1241.

Examples

>>> import numpy as np
>>> x = np.random.normal(size=100)
>>> theta_jack, se = block_jackknife(x, np.mean, n_blocks=10)