# 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?

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}$$.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 18, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9269025325775146, "perplexity": 646.4021026751166}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-17/segments/1618038059348.9/warc/CC-MAIN-20210410210053-20210411000053-00033.warc.gz"}