DFMResult.r_squared#
- DFMResult.r_squared()[source]#
Share of each series’ variance the common component explains.
On the standardized scale each column has unit variance, so the share is \(1 - \operatorname{Var}(e_i)\); its mean across series is
variance_shares.sum().- Return type:
- Returns:
A mapping from series name to its common-component
R^2on the standardized scale.
Example
>>> import numpy as np >>> rng = np.random.default_rng(0) >>> f = rng.standard_normal((150, 1)) >>> lam = np.array([[2.0, 1.0, 0.0]]) >>> panel = f @ lam + 0.5 * rng.standard_normal((150, 3)) >>> fit = DFM(panel, order=1, n_factors=1, series_names=("a", "b", "c")).fit() >>> fit = fit.r_squared() >>> list(fit), bool(fit["a"] > fit["b"] > fit["c"]) (['a', 'b', 'c'], True) >>> bool(fit["a"] > 0.9), bool(fit["c"] < 0.1) (True, True)