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.
Covsam (x, y) = sum (xi - xmean) (yi - ymean) / n
Where,
x1, x2,..., xn represent the first sample elements,
y1, y2, ..., yn represent the second sample elements,
xmean and ymean 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.
Covpop (X, Y) = sum (xi - xmean) (yi - ymean) / (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 xi and yi, Garret randomly selects five closing rates.
i | xi |
| yi | 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).