How to construct a covariance matrix from a 2x2 data set
so if given a covariance matrix I can find the eigenvalues and move forward from there... but I seem to have trouble with the step before if I am given a data set and am told to create the covariance matrix. Looking at the notes I see the formula: $$cov(x) = \frac{1}{n-1}\sum(x_i - \bar{x})(y_i -\bar{y}) $$
I'm not too sure what to do with this formula and was hoping you can tell me how.
Data Set:
X1 | X2 ---|--- 3 | 7 2 | 4
The variance-covariance matrix has the following structure: $$\begin{bmatrix} var(x) & cov(x,y) \\ cov(x,y) & var(y) \end{bmatrix}$$
where $var(x) = \frac{1}{n-1} \sum (x_i - \bar{x})^2 $ and $cov(x,y) = \frac{1}{n-1} \sum (x_i - \bar{x})(y_i - \bar{y}) $.
for your data,
$\bar{x} = \frac{(3 + 2)}{2} = \frac{5}{2}$
$\bar{y} = \frac{(7 + 4)}{2} = \frac{11}{2}$
$var(x) = (3 - \frac{5}{2})^2 + (2 - \frac{5}{2})^2$
$var(y) = (7 - \frac{11}{2})^2 + (4 - \frac{11}{2})^2$
$cov(x,y) = (3 - \frac{5}{2})(7 - \frac{11}{2}) + (2 - \frac{5}{2})(4 - \frac{11}{2})$
so, all you need to do is calculate these values and put them in the right places in the matrix. Does that make sense?