'Coefficients of determination (:math:`R^2`) from regressions of
individual estimated factors on endogenous variables.
Returns
coefficients_of_determination : array
A `k_endog` x `k_factors` array, where
`coefficients_of_determination[i, j]` represents the :math:`R^2`
value from a regression of factor `j` and a constant on endogenous
variable `i`.
Notes
Although it can be difficult to interpret the estimated factor loadings
and factors, it is often helpful to use the cofficients of
determination from univariate regressions to assess the importance of
each factor in explaining the variation in each endogenous variable.
In models with many variables and factors, this can sometimes lend
interpretation to the factors (for example sometimes one factor will
load primarily on real variables and another on nominal variables).
See Also
plot_coefficients_of_determination'

@cache_readonly
def coefficients_of_determination(self):

    from statsmodels.tools import add_constant
    spec = self.specification
    coefficients = np.zeros((spec.k_endog, spec.k_factors))
    which = ('filtered' if (self.smoothed_state is None) else 'smoothed')
    for i in range(spec.k_factors):
        exog = add_constant(self.factors[which][i])
        for j in range(spec.k_endog):
            endog = self.filter_results.endog[j]
            coefficients[(j, i)] = OLS(endog, exog).fit().rsquared
    return coefficients
