Covariance assesses how the mean values of two variables move together. If the return on stock A moves up as the return on stock B moves up and the same relationship is found when the return on stock A decreases, then these stocks are said to have positive covariance. In finance, covariance is calculated to help diversify holdings of securities.

When the analyst has a set of data, a pair of x and y values, covariance can be calculated using five variables from that data. They are:

xi = the value of x given in the data set

xm = mean or average of x-values

yi = the y value in the dataset that corresponds to xi

ym = mean or mean of y-values

N = number of data points

Given this information, the covariance formula is: Cov (x, y) = SUM [(xi - xm) * (yi - ym)] / (n - 1)

While covariance measures the directional relationship between two assets, it does not show the strength of the relationship between the two assets; Correlation coefficient is a more appropriate indicator of this strength.

**Applications of covariance**

Variants have important applications in finance and modern portfolio theory. For example, in the Capital Asset Pricing Model (CAPM), which is used to calculate the expected return of an asset, the covariance between a security and the market is used in the formula for one of the model's key variables, Beta. In CAPM, beta measures the volatility, or systemic risk, of a security compared to the market as a whole; It is a practical measure of covariance to measure an investor's exposure to risks specific to a single security.

Meanwhile, portfolio theory uses covariances to statistically reduce overall portfolio risk by shielding volatility through diversification based on covariance.

Owning financial assets with similar returns that have similar variations does not provide much diversity; Therefore, a diversified portfolio is likely to contain a mix of financial assets having different heterogeneities.

**Example of calculating covariance**

Assume an analyst at a company has a data set of five quarters that shows quarterly GDP growth in percentages (x) and the company's new product line growth in percentages (y). The dataset might look like this:

Q1: x = 2, y = 10

Q2: x = 3, y = 14

Q3: x = 2.7, y = 12

Q4: x = 3.2, y = 15

Q5: x = 4.1, y = 20

The average value of x is 3, and the average value of y equals 14.2. To calculate the covariance, the sum of the product of the xi values minus the mean of the x value, multiplied by the yi values minus the mean of the y values by (n-1), will be divided as follows:

Cov (x, y) = ((2-3) x (10 - 14.2) + (3 - 3) x (14 - 14.2) + ... (4.1 - 3) x (20 - 14.2)) / 4 = (4.2 + 0 + 0.66 + 0.16 + 6.38) / 4 = 2.85

After computing the positive covariance here, the analyst can say that the growth of the company's new product line has a positive correlation with the quarterly GDP growth.

**https://www.freeforex-signals.com/**