# Why use square root of companies market cap in the WLS matrix

When doing a regression based performance attribution I see that people normally use WLS.

So that both our independent and dependent variables are multiplied by our WLS matrix, which is a diagonal matrix that where the values on the diagonal are the square root of the companies market cap.

X = X .* WLS

y = y .* WLS

My question is why use the square root of the market cap of a company rather than say just the benchmark weights? Is it simply in case there is an off benchmark name?

## 1 Answer

It depends on your (assumed) underlying data generation process.

In general, Weighted Least Squares (WLS) can be used when your data is heteroscedastic but still uncorrelated.

Assume a linear model

$$Y_i = \beta_0 + \beta_1 X_i + \epsilon_i \tag{1}$$

If you assume $$var(\epsilon_i) = \sigma^2$$, i.e. the error terms are homoscedastic, OLS is the best linear unbiased estimator (BLUE). However, if you allow errors to be heteroscedastic, we have $$var(\epsilon_i) = \sigma_i^2$$, so the variance of residuals depends on the specific observation. However, you can rewrite the latter model as:

$$var(\epsilon_i) = \sigma_i^2 = \sigma^2 \cdot d_i \tag{2}$$

,so you can account for heteroscedasticity by assuming an overall constant error variance (just like OLS), but weighting each error term with a factor $$d_i$$. If you would divide $$\epsilon_i$$ by $$d_i$$, as in $$\theta_i = \frac{\epsilon_i}{\sqrt{d_i}}$$, you obtain

$$var(\theta_i) = var \left( \frac{\epsilon_i}{\sqrt{d_i}} \right)= \frac{\sigma_i^2}{d_i} = \sigma^2 = const \tag{3}$$

,which makes OLS applicable again. In fact, assuming (2), WLS is just OLS with a transformed model by dividing any observation by $$\sqrt(d_i)$$.

So how is the underlying weighting $$w_i$$ for any observation $$x_i$$ in the least square algorithm? In the case of OLS, we have $$w_i \propto X_i$$, wheres in WLS, each observation weight is proportional to $$X_i / \sqrt{d_i}$$.

In summary, for $$d_i$$ as the market capitalization of a firm, if you assume for the residual variance that $$var(\sigma_i^2) = \sigma^2 \cdot d_i$$ holds, i.e. the error variance is proportional to the market capitalization, you have to weight each observation $$X_i$$ with $$\sqrt{d_i}$$.