ar_p – Autoregressive AR(p) on the target.#
Back to family axis | Back to L4 | Browse all options
Operational op under axis
family, sub-layerL4_A_model_selection, layerl4. Standalone callable:mf.functions.ar_fit.
Function signature#
mf.functions.ar_fit(
X: np.ndarray | pd.DataFrame,
y: np.ndarray | pd.Series,
) -> ARFitResult
Parameters#
name |
type |
default |
constraint |
description |
|---|---|---|---|---|
|
`np.ndarray |
pd.DataFrame` |
— |
— |
|
`np.ndarray |
pd.Series` |
— |
— |
Returns#
ARFitResult — frozen dataclass with fit results.
Attribute |
Type |
Description |
|---|---|---|
|
|
AR lag order p. |
|
|
Fitted AR coefficients, shape (n_lags,). |
|
|
Fitted intercept. |
|
|
Predictions for new data X, shape (n_samples,). |
|
|
Table: AR order, intercept, per-lag coefficients. |
Behavior#
Pure autoregression – predictor matrix is the lagged target (no exogenous regressors). params.n_lag sets p. Useful as a non-trivial benchmark in macro forecasting where the lagged target captures most of the predictability.
When to use
Default benchmark in any forecasting horse race; replication of papers reporting AR baselines.
In recipe context#
Set params.family = "ar_p" in the relevant layer to activate this op within a recipe:
# Layer L4 recipe fragment
params:
family: ar_p
References#
macroforecast design Part 2, L4: ‘forecasting model is the layer where every authoring iteration ends – pick family, tune, repeat.’
Stock & Watson (2007) ‘Why Has US Inflation Become Harder to Forecast?’, JMCB 39.