> [!tldr] Factor Models
> Factor models decompose stock returns $r_{t}$ into a few **factor returns** $\mathbf{f}_{t}=(f_{1t},\dots)$ and the stock's **idiosyncratic returns** $\epsilon_{t}$.
>
> A stock has **characteristics**, controls how a stock is influenced by a factor. If we collect them into a vector $\beta$, we have $r_{t}=\alpha + \mathbf{f}_{t}\beta+\epsilon_{t}.$
> The intercept is called **alphas**, which are systematic, consistent edge a stock has over the factors.
There are two approaches to estimate the factor model:
- One is to estimate $\mathbf{f}_{t}$ with various proxies, e.g. the S&P index for the overall US economy, then fit the [[Linear Regression Methods|linear regression]] $r \sim \mathbf{f}$ (dataset including observations over different $t$) to get the **betas** $\hat{\beta}$.
- The other is to fix $\beta$ to be 0-1 and have them assigned manually (as in the case sold by data vendors) to stocks. We then fit $\mathbf{f}_{t}$ as their coefficients in the regression $\mathbf{r}_{t} \sim \beta$, where $\mathbf{r}_{t}$ are returns of various stocks all on the same day $t$. This produces the coefficient estimates $\hat{\mathbf{f}}_{t}$. In this case the design matrix (where each row is the beta of a stock) is the **loadings matrix**.
### Factor-Neutral Portfolios
Suppose we want to built a portfolio of stocks, with weights $w^{\ast}$ computed from some weighing mechanism (e.g. equal weighting, [[Mean-Variance Optimal Portfolio|MVO]]).
But now we want to remove any exposure to a number of factors using the loadings matrix $\mathbf{B}$, with some minimal modifications. This creates the optimization problem $\min_{w}\| w-w^{\ast} \|,~~\mathrm{s.\!t.}~\mathbf{B}^{T}w=\mathbf{0}.$
We can apply (vector-valued) Lagrange multipliers to get $\begin{align*}
J(w,\lambda)&:= \| w-w^{\ast} \| ^{2}-\lambda^{T}\mathbf{B}^{T}w,\\
\nabla_{w}J&= -2w^{\ast}+2w-\mathbf{B}\lambda \equiv 0.
\end{align*}$
Left-applying $\mathbf{B}^{T}$ and using $\mathbf{B}^{T}w=\mathbf{0}$ gives $\lambda=(\mathbf{B}^{T}\mathbf{B})^{-1}\mathbf{B}^{T}w^{\ast}$, so $w=(I-\mathbf{B}(\mathbf{B}^{T}\mathbf{B})^{-1}\mathbf{B})w^{\ast},$i.e. removing the projection of $w^{\ast}$ onto the column space of $\mathbf{B}$. Equivalently, we can obtain $w$ as the residuals of the OLS $w^{\ast} \sim \mathbf{B}$.
### Factor-Idiosyncratic Decomposition
Since by definition the idio returns are independent of the factor returns, the portfolio's variance can be decomposed into $\text{portfolio var}=\text{idio var}+\text{factor var}.$
So with weights $w$ and covariance matrices of the returns, idiosyncrasies, and factors, we have $\underset{\text{portfolio var}}{w^{T}\Sigma_{r}w \vphantom{_{f}}}=\underset{\text{idio var}}{w^{T}\Sigma_{\epsilon}w\vphantom{_{f}}}+\underset{\text{factor var}}{w^{T}B^{T}\Sigma_{f}Bw}$
^5d1660
However, since idiosyncratic returns are just the residuals of the linear regression $r \sim \mathbf{B}$, this is just the population form of $\mathrm{TSS}_{w}=\mathrm{RSS}_{w}+\mathrm{ESS}_{w}$where the sum-of-squares are weighted by $w$ instead of the usual $\mathbf{1}=(1,\dots,1)$.