×

X

Enter the values for dataset ** X** and

Table of Contents:

The following covariance equation is the sample covariance formula **Cov(x,y) **if two sample sizes are available**.**

**Cov _{sam }(x, y) = sum (x_{i} – x _{mean}) (y_{i} – y _{mean}) / n**

Where:

** X _{mean}** refers to the mean value of these sample elements.

** Y _{mean}**refers to the mean value of second sample elements.

** x_{i}– x _{mean}** represents the difference between sample elements for

** y_{i}– y _{mean}** represents the difference between sample elements for

** n** represents the size of the sample for both

The covariance of x and y calculator** **above uses this equation to find the covariance.

Covariance calculator is an online statistical tool that is used to calculate the relationship between the two sets of variables ** X** and

It also calculates the mean value for ** X** and

Covariance measures how many random **(X, Y) **variables in each population are distinct. When the population is greater or random, the matrix represents the relation between different dimensions.

Variance, covariance, and coefficient of variance are vitally associated to each other.

Covariance properties can be stated as:

- The smaller
**X**and greater**Y**values give the positive covariance.

**X < Y è +ve covariance**

- The greater
**X**and the smaller**Y**values shows covariance is negative.

**X > Y è -ve covariance**

- The covariance would be negative or non-linear if all random variables are not statistically dependent.

Calculating covariance is comparatively easy if you use **stock covariance calculator. **Manual calculation is bit tricky but we will explain the method by keeping it as simple as possible.

**Example:**

**Betty** has purchased the stocks of **Retro plastics** recently. She wants to purchase one more company’s stocks to broaden her investment but in different industry. She has got two great options after some research, i.e., **sun autos** and **DM textiles. **But she doesn’t know which option she should opt out.

She can decide by calculating the covariance for return on both houses.

Betty gets the five closing prices for both of the companies, **sun autos** and **DM textiles**.

Prices of **sun autos **represents **x _{i,}** and prices of

i | x_{i} | y_{i} |

1 | 8.47 | 10.63 |

2 | 11.22 | 9.21 |

3 | 11.99 | 10.71 |

4 | 11.45 | 8.01 |

5 | 10.92 | 5.03 |

Mean value | 10.81 | 8.718 |

Follow these steps carefully to get the covariance:

**Step 1**: Calculate the mean value for **x _{i}.** Add all values and divide the sum by size of the sample (5).

**X _{mean}** = 10.81

**Step 2**: Calculate the mean value for **y _{i }**too. Add all values and divide the sum by size of the sample (5).

**Y _{mean}** = 8.718

Step 3: Calculate the **x _{diff.}** Difference of

**x _{diff} = x_{i} – x _{mean}**

To find differences for all **x** values, use the above equation and place them in a column.

**Step 4:** Repeat the previous step for **y**. Calculate **y _{diff}** by subtracting all values of

**Y _{diff} = y_{i} – y _{mean}**

**Step 5:** Multiply all values of **x _{ diff}** and

**Step 6:** Add the values of last column, which are the product of the two differences. After adding, divide the sum by the sample size. After dividing the sum by sample size, the resulting value will be the covariance.

Sum of differences = **-1.65911**

**Cov _{sam }(x, y) = -1.65911 / 5**

**Cov _{sam }(x, y) =**

i | x_{i} | y_{i} | x _{diff} | y _{diff} | x _{diff} × y _{diff} |

1 | 8.47 | 10.63 | -2.34 | 1.912 | -4.47 |

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 | 10.81 | 8.718 | -1.65911 |

The covariance value **-0.3318 **gives us the idea about variation in the prices of both companies. By using this value, Betty can decide to buy stocks of one of them.

You can use the** **population covariance calculator** **above to cross-check the result of covariance calculation.

Apr 5, 2021 What is covariance