FAVARResult.common_component#
- FAVARResult.common_component()[source]#
The panel as the factors and observed block see it, in original units.
\(\hat x_t = s \odot (\Lambda^F F_t + \Lambda^Y Y_t) + \bar x\).
- Return type:
- Returns:
An
(nobs, n_series)array; the gap between this andpanelis the idiosyncratic component, and each series’r2says how much of it there is.
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).fit() >>> common = res.common_component() >>> common.shape (300, 30) >>> total = ((panel - panel.mean(axis=0)) ** 2).sum(axis=0) >>> fit = 1.0 - ((panel - common) ** 2).sum(axis=0) / total >>> bool(np.allclose(fit, res.r2)) True