# Weighting stocks by market capitalization in a cross-sectional weighted regression

I am trying to regress stock returns on a series of factor scores to get factor coefficients. I want to weight the regression by the square root of market cap which I'm doing by applying a weighting function to my x and y variables before running the regression.

I'm a bit confused, however, but whether I should be using square root or fourth root as in the end I'm trying to minimize the square of the errors. Does this mean I need to use fourth root or have I over-complicated it?

Thanks!

Let $$\text{SSR}$$ denote the sum of squared residuals and $$\text{WSSR}$$ the weighted $$\text{SSR}$$. Standard OLS-regression approach minimizes the $$\text{SSR}$$ with $$y$$ as the dependent and $$y$$ as the independent variable:

$$\text{SSR}(\beta) = \sum^n_{i=1}{(y_i - \hat{x}_i \cdot \beta)^2}$$

The WLS-approach adds a weight $$w$$ for each of the observations $$x_i$$. OLS-regression is the special case of WLS when applying $$w=1$$ for all $$x_i$$. WLS minimizes the weighted $$\text{SSR}$$:

$$\text{SSR}(\beta, w) = \sum^n_{i=1}{w \cdot (y_i - \hat{x}_i \cdot \beta)^2}$$

If your weights $$w_i$$ are the squared root of firms $$i$$ market cap, this results in:

$$\text{SSR}(\beta, w) = \sum^n_{i=1}{\sqrt{MV_i} \cdot (y_i - \hat{x}_i \cdot \beta)^2}$$

where $$MV_i$$ is the market capitalization of firm $$i$$. As a result, the weight $$w$$ still remains the "squared" root and not the "fourth".

In Python, WLS with weights from one to seven is applied as:

import statsmodels.api as sm
Y = [1,3,4,5,2,3,4]
X = range(1,8)

y <- c(1,3,4,5,2,3,4)