4
$\begingroup$

Prove that $$(n-1)S = X^TX -{1\over{n}}(X^T\vec1)(\vec1^TX) = X^TX-n\vec{\bar x}\vec{\bar x}^T$$

My attempt so far goes like this

$$S = {1\over{n-1}}X_m^TX_m$$

Edit: Where $X_m$ is the mean corrected matrix. So

$$(n-1)S = (X-\vec1\vec{\bar x^T})^T(X-\vec1\vec{\bar x^T})$$ $$=(X^T-\vec{\bar x}\vec{1^T})(X-\vec1\vec{\bar x^T})$$ $$=X^TX -X^T\vec1\vec{\bar x^T}-\bar x\vec1^TX + \vec {\bar x}\vec1^T\vec1\vec {\bar x^T}$$

I think the last term can be written as $n\vec {\bar x}\vec {\bar x^T}$ but beyond that I'm not sure where to go from there (if I'm even right so far).

$\endgroup$
2
  • $\begingroup$ If $X$ is a vector, then $\bar x$ should be presented as a scalar, not as a vector. Is this the case? $\endgroup$ Oct 27, 2014 at 15:29
  • $\begingroup$ $X$ is $n$ observations of $p$ variables, so the mean vector is the vector of the mean of variable 1, 2, ... , p $$ \vec {\bar x} = (\bar x_1, \bar x_2, ... ,\bar x_p)^T$$ $\endgroup$
    – user123965
    Oct 27, 2014 at 17:15

1 Answer 1

4
$\begingroup$

After the OP's clarifications, $X$ is not a vector but a matrix, and $S$ is a variance covariance matrix.

We have that $\vec{1^T} \vec1= n$, a scalar.

Also, $X^T\vec1$ produces a $p \times 1$ column vector with $\sum_{i=1}^n x_{ji}$ in each position, for the $j=1,...,p$ variables. Multiply and divide by $n$ to get

$$X^T\vec1\vec{\bar x^T} = n\cdot \left(\frac 1n X^T\vec1\right)\vec{\bar x^T} =n\vec{\bar x}\vec{\bar x^T}$$

I guess the OP can take it from here.

$\endgroup$
2
  • $\begingroup$ Thanks, I think I have it now. So similarly $\vec{1^T}X$ becomes the $p \times 1$ vector with the same values. Therefore $\vec {\bar x} \vec{1^T} X$ is also $n\vec{\bar x}\vec{\bar x^T}$ $\endgroup$
    – user123965
    Oct 27, 2014 at 19:10
  • $\begingroup$ Exactly. Sometimes notation may get in the way, but the result is exactly analogous to the univariate case. $\endgroup$ Oct 27, 2014 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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