To calculate result you have to disable your ad blocker first.

# Covariance Calculator

Enter the values for dataset ** X** and

**in the given input boxes. Hit that**

*Y***Calculate**button to get the covariance and mean value for

**and**

*X***using sample covariance calculator.**

*Y*Table of Contents:

## Covariance formula

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

**X**and the mean value of the sample.

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

**Y**and the mean value of the sample.

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

**X**and

**Y.**

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

**that are commonly described.**

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

**along with calculating covariance. Here, we will explain covariance definition, how to find covariance, formula for covariance, and how do you calculate covariance with examples.**

*Y*## What is covariance?

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.

### Properties of covariance

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.

## How to calculate covariance?

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

**DM textiles**represents

**y**

_{i.}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**can be calculated by subtracting each element of

**x**from

**x**

_{mean}.**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**from the

**y**

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

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

**y**and place them in the next column.

_{ diff }**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) =**

**-0.3318**

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.

### **Recent Blog Posts**

Apr 5, 2021 What is covariance