dfm – Dynamic factor model – Kalman state-space factor extraction.#
Back to op axis | Back to L3 | Browse all options
Operational op under axis
op, sub-layerL3_A_step_op, layerl3. Standalone callable:mf.functions.dfm_transform.
Function signature#
mf.functions.dfm_transform(
panel: pd.DataFrame,
n_factors: int,
) -> pd.DataFrame
Parameters#
name |
type |
default |
constraint |
description |
|---|---|---|---|---|
|
|
— |
— |
Input panel. Each column is a variable; rows are time periods. Series is promoted to a single-column DataFrame internally. |
|
|
|
>= 1 |
Number of latent dynamic factors to extract. Clamped internally to min(T_clean, K) - 1. |
Returns#
pd.DataFrame — scalar result.
Behavior#
statsmodels DynamicFactor MLE estimate of latent factors with idiosyncratic AR(1) errors. Differs from pca in that factors are smoothed via the Kalman filter and respect a factor-VAR transition.
When the panel is mixed-frequency (FRED-SD), the runtime auto-routes to DynamicFactorMQ (Mariano-Murasawa 2003).
When to use
Smoothed factors with an explicit dynamic; mixed-frequency panels (FRED-SD).
In recipe context#
Set params.op = "dfm" in the relevant layer to activate this op within a recipe:
# Layer L3 recipe fragment
params:
op: dfm
References#
macroforecast design Part 2, L3: ‘feature engineering is a DAG of typed transforms; cascade-depth bounds the longest chain at cascade_max_depth.’
Mariano & Murasawa (2003) ‘A new coincident index of business cycles based on monthly and quarterly series’, JAE 18(4): 427-443.