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 slow was declared, fits the VAR on [F, Y] under the names f1 ... fr and the observed labels, and fits the observation equation of every standardized series on the augmented block.

Return type:

FAVARResult

Returns:

The fitted result, its factors ready for any identification model.

Raises:

SpecificationError – If order or trend is 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)