numeraire.newey_west_lrv#
- numeraire.newey_west_lrv(x: NDArray[float64], lags: int = 0, valid: NDArray[bool] | None = None) float[source]#
Bartlett-kernel long-run variance of a 1-D series (
lags=0= plain variance, MLE).lrv = g0 + 2 * sum_{l=1..lags} (1 - l/(lags+1)) * g_lwithg_lthe lag-lautocovariance (denominatorT).valid(optional, same shape asx) marks which positions are observed. When given, the mean and every autocovariance use only the observed values, and lag-lpairs are formed from observations exactlylpositions apart on the original axis (withn= the number of observed positions). This keeps HAC lags meaningful for a series with internal gaps — compacting the gaps away would treat observations several periods apart as adjacent. The default (None) is the dense behavior: every position observed.