qis.compute_ar_residuals¶
- qis.compute_ar_residuals(data)[source]¶
fit an AR(1) per column and return the residuals on complete lag pairs.
A lag pair at t is usable when every column is observed at both t and t-1. Estimating and residualising on that same set is what keeps the returned arrays aligned, and what stops a gap being read as a one-period step. Rows must be complete across all columns because
bootstrap_ar_processresamples rows jointly to preserve the cross-section.The coefficient is the conditional maximum likelihood estimate, which for an AR(1) is ordinary least squares of the series on its own lag.
- Parameters:
data (Series | DataFrame) – observations, one column per series
- Returns:
Tuple of (residuals, intercept, beta).
residualshas one row per usable lag pair and one column per series, and contains no NaN.interceptandbetahave one entry per series- Raises:
ValueError – if no column is present, or if fewer than three usable lag pairs survive, below which an AR(1) is not identified
- Return type: