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)
Where:
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.
$\endgroup$2 Answers
$\begingroup$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.
$\endgroup$ $\begingroup$@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.
$\endgroup$