FAVAR.fit#
- FAVAR.fit()[source]#
Extract the factors, clean them, and estimate the augmented VAR.
Standardizes the panel by its means and population standard deviations (a constant column keeps scale 1), takes the components, regresses the observed block out of them against the slow-panel components when
slowwas declared, fits the VAR on[F, Y]under the namesf1 ... frand the observed labels, and fits the observation equation of every standardized series on the augmented block.- Return type:
- Returns:
The fitted result, its
factorsready for any identification model.- Raises:
SpecificationError – If
orderortrendis rejected by the augmented VAR.
Example
>>> import numpy as np >>> rng = np.random.default_rng(0) >>> factor = np.zeros(300) >>> for t in range(1, 300): ... factor[t] = 0.7 * factor[t - 1] + rng.standard_normal() >>> panel = np.outer(factor, rng.uniform(0.5, 1.5, 30)) >>> panel += 0.3 * rng.standard_normal((300, 30)) >>> policy = 0.4 * factor + rng.standard_normal(300) >>> res = FAVAR( ... panel, policy[:, None], n_factors=1, order=1, observed_names=("rate",) ... ).fit() >>> res.factors.names, res.factors.order, res.factors.is_stable (('f1', 'rate'), 1, True) >>> bool(abs(res.scores.mean()) < 1e-12), bool(res.r2.min() > 0.5) (True, True)