I tried searching a lot on the net and got the following sources:

  • Source One
  • Source Two
  • The first source seems to be incorrect cause when I calculate it using matlab it comes to be different from what they have given as the answer. As for the second link I cant understand that cause its not completely explaining as to how to calculate. Could anyone please provide me with a sound link or explain how to calculate a co-variance matrix?

    • $\begingroup$ What covariance matrix? The covariance matrix for the OLS estimator is not the same thing as the covariance matrix for the residuals, for example, if we think of a regression context. You need to be more specific. Do you mean sample (co)variance (whose univariate counterpart is $(n-1)^{-1}\sum_{i=1}^n(x_i-\bar{x})^2$)? $\endgroup$ – hejseb Nov 11 '13 at 20:58
    • $\begingroup$ I got my answer finally. Have posted it below. $\endgroup$ – Sohaib I Nov 12 '13 at 4:23
    • $\begingroup$ Where? ${ }$ ${ }$ ${ }$ ${ }$ $\endgroup$ – draks ... Nov 12 '13 at 6:23
    • $\begingroup$ @draks... Bah! Internet problem. Now done! $\endgroup$ – Sohaib I Nov 12 '13 at 13:38

    I finally understood the concept behind co-variance. Co-variance is different for population data and sample data.

    Following is the method I followed:

    Let $A$ be a $n \times m$ matrix where $n$ is the number of rows (observations) and $m$ represents the number of columns (variables).
    Let $\mathbf e$ be the $n \times 1$ column vector composed entirely of ones. Then, $$ X= A - \left(\frac{1}{n}\right)\mathbf e\mathbf e^TA $$ Then, denote $$ Y = X^TX. $$

    Next is the step that differs for population data and sample data.

    In case of population data, the covariance matrix $\Sigma$ is given by : $$ \Sigma=\left(\frac{1}{n}\right)Y $$
    and in case of sample data, the covariance matrix $\Sigma$ is given by : $$ \Sigma=\left(\frac{1}{n-1}\right)Y $$ Hope it helps anyone stuck on a similar problem.

    | cite | improve this answer | |
    • $\begingroup$ I've erroneously accepted an edit that was not quite right; now I've tried to edit to adress the confusion that existed prior to this edit. I hope I didn't make things worse. $\endgroup$ – Arnaud D. Apr 25 '19 at 14:27

    Your Answer

    By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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