Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wanted to compute Beta for a Stock against an Index (Say Stock X against S&P 500).

I computed the daily returns for over one year applied the following logic :

Beta = COVAR(X, S&P 500)/VARP(S&P 500)


COVAR : Returns Covariance, the average of the products of deviations for each data point pair. VARP : Variance of the entire population.

The problem I run into is, X has few missing data points, and the daily returns has lot of NAN, hence I seem to get some bad COVAR.

Linear Regression was suggested here, I would like to know how Linear Regression can solve the bad data issue here, also how different is Beta computation using COVAR and Linear Regression.

share|cite|improve this question
up vote 0 down vote accepted

You will get the same answer using linear regression or using the covariance formula. This is because the covariance formula is derived from a linear regression.

In more details, if $X_t$ is the return of the stock on day $t$ and $S_t$ is the return of the index, and $\epsilon_t$ is the error, then you have a model

$$X_t = \alpha + \beta S_t + \epsilon_t$$

Performing a linear regression of $X_t$ against $S_t$ will return the parameters $\alpha$ and $\beta$. You can show that the returned value for $\beta$ will be

$$\beta = \frac{E(XS) - E(X)E(S)}{E(S^2)-E(S)^2} = \frac{\mathrm{Cov}(X,S)}{\mathrm{Var}(S)}$$

which is the same as the formula you have. Unfortunately there's not a lot you can do except get better data.

share|cite|improve this answer

@Chris Taylor:

This formula is only valid for regressions with only one explanatory variable. Adding regressors makes the link disappear as regressions give you the conditional correlation/covariance when the cov(x,y) gives you the unconditional covariance.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.