# Linear Factor Models for Asset Pricing¶

Factor models are commonly used to test whether a set of factors, for example the market (CAP-M) or the Fama-French 3 (Market, Size and Value) can explain the return in a set of test portfolio. The economic hypothesis tested is that

$E[r_{it}] = \lambda_0 + \beta_i \lambda$

where $$\beta_i$$ is a set of factor loadings and $$\lambda$$ are the risk premia associated with the factors. $$\lambda_0$$ is the risk-free rate.

When all of the factors are traded, a simple Seemingly Unrelated Regression (SUR) approach can be used to test whether the factors price the test portfolios. This is possible since the expected average return on a factor must equal the factor’s risk premium. TradedFactorModel implements this model and allows the specification to be testes with a J-statistic of the form

$J = \hat{\alpha}^{\prime} \hat{\Sigma}_{\alpha} \hat{\alpha} \sim \chi^2_P$

where there are P portfolios.

When some factors are not-traded, for example macroeconomic shocks, then a 2-step procedure is required since the average value of the factors does not necessarily equal the risk premium associated with the factor. The first step estimates the factor exposures (effectively) using demeaned factors, and the second step estimates the risk premia using the factor exposures as regressors so that the estimated risk premia attempt to price the cross-section of assets as well as possible. A similar J-statistic can be used to test the model, although it has a different distribution,

$J = \hat{\alpha}^{\prime} \hat{\Sigma}_{\alpha} \hat{\alpha} \sim \chi^2_{P-K}$

where K is the number of factors. LinearFactorModel implements this two-step estimator. LinearFactorModelGMM contains a more efficient estimator of the same model using over-identified GMM.

Both estimators can be used with either a heteroskedasticity-robust covariance by setting cov_type='robust' or a HAC covariance estimator using cov_type='kernel'. The HAC estimator supports three kernel weight generators, ‘bartlett` or newey-west which uses a triangular kernel, ‘parzen’ and ‘qs’ (or ‘quadratic-spectral’).

Formulas and Mathematical Detail contains a concise explanation of the formulas used in estimating parameters, estimating covariances and implementing hypothesis tests.