Our covariance calculator measures the relation between the two sets of variables often referred X and Y. It is an online statistics calculator for covariance, which involves two random variables X and Y and calculates variation between these two variables. It assists us in comprehending the relationship between two data sets.
Covariance tests how much in one population, two random variables (X, Y) vary. If the population has higher dimensions or random variables, the relation between different dimensions is represented by a matrix.
The following covariance equation is the formula for sample covariance if two equal-sized samples are available.
Cov_{sam }(x, y) = sum (x_{i} - x_{mean}) (y_{i} - y_{mean}) / n
Where,
x_{1}, x_{2},..., x_{n }represent the first sample elements,
y_{1}, y_{2}, ..., y_{n} represent the second sample elements,
x_{mean }and y_{mean }represents the average values.
The relationship between covariance and variance can be written as:
Cov (X, X) = Var (X)
Here is the population covariance formula.
Cov_{pop }(X, Y) = sum (x_{i} - x_{mean}) (y_{i} - y_{mean}) / (n-1)
We will see how the covariance formula works in a real-life situation by using a real-life example.
Example:
Garret is an investor who recently bought his first few shares in "Home for all," which is a real estate company. Yet Garret had to diversify his investments, and therefore decided to buy certain shares in both the “Stars Estates” and “Your Property.”
The problem for Garret is which companies he should invest in. That is where covariance comes in handy to decide for Garret.
Solution:
For stocks of the “Home for all” and “Star Estates,” denoted respectively by x_{i} and y_{i}, Garret randomly selects five closing rates.
i | x_{i} |
| y_{i} | x _{diff} | y _{diff} | x _{diff} × y _{diff} |
1 | 11.24 |
| 8.30 | -0.124 | 0.048 | -0.00595 |
2 | 11.22 |
| 9.21 | -0.144 | 0.958 | -0.1380 |
3 | 11.99 |
| 10.71 | 0.626 | 2.458 | 1.5387 |
4 | 11.45 |
| 8.01 | 0.086 | -0.242 | -0.02081 |
5 | 10.92 |
| 5.03 | -0.444 | -3.222 | 1.431 |
Mean value | 11.364 |
| 8.252 |
If you are wondering about how to find covariance from here, follow these steps, or you can use our covariance tool to find covariance quickly.
We can say that the closing price for both companies varies to around this calculated value of covariance (0.561).