# Thread: (OLS) How to get sample variance-covariance matrix of residuals?

1. ## (OLS) How to get sample variance-covariance matrix of residuals?

Consider the OLS:

(1) y = a + b*x + e

Where e is the error term. I understand that the population variance-covariance matrix for the residuals is ee', but for the sample var-covar matrix do I need to do any d.f. adjustments?

2. ## Re: (OLS) How to get sample variance-covariance matrix of residuals?

Are you assuming the covariance matrix looks like (ie the observations have constant variance and are independent)?

If so and if you only have an intercept and a slope and you're using the residuals as your stand in for the errors (so instead of you use ) it is typical to use

Also note that to get the population covariance matrix you actually need E[ee'].

3. ## The Following User Says Thank You to Dason For This Useful Post:

derksheng (07-16-2012)

4. ## Re: (OLS) How to get sample variance-covariance matrix of residuals?

Very informative post. Thanks for that.

I'm actually working with heteroscedasticity and serial correlation.

5. ## Re: (OLS) How to get sample variance-covariance matrix of residuals?

Are there a few parameters in the proposed covariance matrix? It's not really possible to just estimate the covariance matrix in general without more information.

6. ## Re: (OLS) How to get sample variance-covariance matrix of residuals?

I wasn't aware that it wasn't straight forward. I have the cross-sectional (1) . Both gamma and epsilon are stochastic.

F is a matrix of factors (the first column is 1, for the intercept).

Using "Portfolio Weighted Least Squares" from Chandra and Balachandran (1992)*, we have and , where S is the estimated variance-covariance matrix computed from (1) using (but the authors don't provide details). .
is the diagonal of

So I'll need the var-covar of (1) to estimate this regression.

*More Powerful Portfolio Approaches to Regressing Abnormal Returns on Firm-SpecificVariables for Cross-Sectional
http://www.jstor.org/discover/10.230...id=56310633793

7. ## Re: (OLS) How to get sample variance-covariance matrix of residuals?

I'm not on campus right now and can't access that article otherwise I'd take a look at it.