How to Find Covariance Matrix?
The dimensions of a covariance matrix are determined by the number of variables in a given data set. If there are only two variables in a set, then the covariance matrix would have two rows and two columns. Similarly, if a data set has three variables, then its covariance matrix would have three rows and three columns.
The data pertains to marks scored by Anna, Caroline, and Laura in Psychology and History. Make a covariance matrix.
Student | Psychology(X) | History(Y) |
---|---|---|
Anna | 80 | 70 |
Caroline | 63 | 20 |
Laura | 100 | 50 |
The following steps have to be followed:
Step 1: Find the mean of variable X. Sum up all the observations in variable X and divide the sum obtained with the number of terms. Thus, (80 + 63 + 100)/3 = 81.
Step 2: Subtract the mean from all observations. (80 – 81), (63 – 81), (100 – 81).
Step 3: Take the squares of the differences obtained above and then add them up. Thus, (80 – 81)2 + (63 – 81)2 + (100 – 81)2.
Step 4: Find the variance of X by dividing the value obtained in Step 3 by 1 less than the total number of observations. var(X) = [(80 – 81)2 + (63 – 81)2 + (100 – 81)2] / (3 – 1) = 343.
Step 5: Similarly, repeat steps 1 to 4 to calculate the variance of Y. Var(Y) = 633.333
Step 6: Choose a pair of variables.
Step 7: Subtract the mean of the first variable (X) from all observations; (80 – 81), (63 – 81), (100 – 81).
Step 8: Repeat the same for variable Y; (70 – 47), (20 – 47), (50 – 47).
Step 9: Multiply the corresponding terms: (80 – 81)(70 – 47), (63 – 81)(20 – 47), (100 – 81)(50 – 47).
Step 10: Find the covariance by adding these values and dividing them by (n – 1). Cov(X, Y) = [(80 – 81)(70 – 47) + (63 – 81)(20 – 47) + (100 – 81)(50 – 47)]/(3-1) = 260.
Step 11: Use the general formula for the covariance matrix to arrange the terms. The matrix becomes: [Tex]\begin{bmatrix} 343 & 260\\ 260& 633.333 \end{bmatrix} [/Tex]
Covariance Matrix
Covariance Matrix is a type of matrix used to describe the covariance values between two items in a random vector. It is also known as the variance-covariance matrix because the variance of each element is represented along the matrix’s major diagonal and the covariance is represented among the non-diagonal elements.
It’s particularly important in fields like data science, machine learning, and finance, where understanding relationships between multiple variables is crucial and comes in handy when it comes to stochastic modeling and principal component analysis.
In this article, we will discuss about various things related to Covariance Matrix such as it’s definition, example, and formula as well.
Table of Content
- What is Covariance Matrix?
- Covariance Matrix Example
- Covariance Matrix Formula
- 2 ⨯ 2 Covariance Matrix
- 3 ⨯ 3 Covariance Matrix
- How to Find Covariance Matrix?
- Properties of Covariance Matrix
- Solved Examples
- Practice Problems
- FAQs