Expand description
Dependence-corrected summaries of a serially correlated sample.
Both statistics read a sequence x_1..x_n whose terms may be autocorrelated
(held-out per-row losses in row order, chain draws) and correct the naive
i.i.d. summary for that dependence with the lag window L = ⌊√n⌋, which
grows with n while its share L/n vanishes — the standard consistent
bandwidth for a sample of unknown correlation length.
Functions§
- autocorr_
ess - Effective sample size
n / (1 + 2 Σ_{k≥1} ρ_k)from the initial positive sequence of sample autocorrelationsρ_k, truncated at the first non-positive lag (Geyer’s rule) and at the lag window⌊√n⌋. Returnsnitself for a degenerate or constant sample and never less than one. - newey_
west_ se - Newey–West (Bartlett-kernel) standard error of the sample mean with lag
window
⌊√n⌋:√(γ_0 + 2 Σ_k w_k γ_k) / √n,w_k = 1 − k/(L+1). Infinite for a sample of fewer than two terms, where no dispersion is measurable.