top of page

What is a variance-covariance matrix?

Are you wondering, "what is a variance-covariance matrix?" Then, it is a square matrix that includes the variances and covariances that are associated with many variables. The matrix's diagonal elements include the variances of variables. The matrix's off-diagonal elements include the covariances between possible pairs of variables.

It is a concept of statistics and probability theory covariance matrix is known by many names such as variance matrix, dispersion matrix, auto-variance matrix, and variance and covariance matrix. It is symmetric and positive semi-definite, with variances on its major diagonal. The covariance matrix intuitively extends the concept of variance to several dimensions.

Because the covariance between X and Y is the same as the covariance between Y and X, the variance-covariance matrix is symmetric. As a result, the covariance for each pair of variables is presented twice in the matrix: the covariance between the ith and jth variables is displayed at locations I j), and the covariance between the ith and jth variables is displayed at places I j) (j, i).

You will find many applications of statistics that help you calculate the variance-covariance matrix, in statistical models, for the estimators of parameters. It is often used to calculate the standard errors or functions of estimators. For instance, for estimated coefficients, logistic regression creates the variance-covariance so that you have covariances between possible parts of coefficients and variances of coefficients.

What are the steps of creating a Variance and Covariance Matrix?

This matrix may be created using a simple method for a portfolio of z stocks and n observations:

Matrix zxz = (1÷n)XT X

The meaning of the formula is as follows:

Matrix z x z = variance-covariance matrix

n = observations’ taken number

z = stocks’ number of in the portfolio

X = excess return matrix

XT = transpose of matrix “X”

These items, on their own, might be puzzling. That's why, as is customary, we'll use an example to grasp it better.

First, let's have a look at the step-by-step method for creating this matrix.

  • First, you need to calculate each stock's daily returns in your portfolio.

  • Then, it would help if you calculated the daily returns average of each stock.

  • Then calculate the difference between daily return and an average stock return, of course. The information you find is the excess return. It will provide you with the excess return matrix we saw in the formula above.

  • Now setting up XT is required, which is the "transpose of excess return matrix.

  • Now, Matrix X is multiplied by matrix XT.

  • Divide each XT X matrix element by n.

Let us understand by a Variance Covariance Matrix Example.

Using the Formula:

n = 5, ¯x = 22.4, var(X) = 321.2 / (5 - 1) = 80.3

¯y = 12.58, var(Y) = 132.148 / 4 = 33.037

¯z = 64, var(Z) = 570 / 4 = 142.5

cov(X, Y) = ∑51(xi−22.4)(yi−12.58)5−1∑15(xi−22.4)(yi−12.58)5−1 = -13.865

cov(X, Z) = ∑51(xi−22.4)(zi−64)5−1∑15(xi−22.4)(zi−64)5−1 = 14.25

cov(Y, Z) = ∑51(yi−12.58)(zi−64)5−1∑15(yi−12.58)(zi−64)5−1 = -39.525

[80.3 -13.86 14.25

-13.86 33.03 -39.52

14.25 -39.52 142.5]

variance-covariance matrix formula

The detail about the variance-covariance matrix formula is given below,

Variance Formula:

Variance is a statistical measure of the variability or spread in a dataset. It is calculated as the average squared departure from the mean score. To calculate population variance, we use the formula below.

● Var (X) = Σ(Xi -X)2/N = Σxi2/N

N = the number of the score in a score' set

X = the N scores' mean.

Xi = the “ith” raw score in a scores’s set

xi = the “ith” deviation score in scores’s set

Var(X) = the variance of all scores in set

Covariance Formula:

The degree to which related items from two sets of ordered data move in the same direction is measured by covariance. To compute population covariance, we use the formula below.

● Cov(X,Y) = Σ (Xi-X) (Yi-Y)/N = Σxiyi/N

N = the number of the score in a score' set

X = the N scores' mean.

Xi = the “ith” raw score in a scores’s set

xi = the “ith” deviation score in scores’s set

Y = N scores’ mean in the second dataset

Yi = the “ith” raw score in the second set of scores

yi = the “ith” deviation score in the second set of scores

Cov(X,Y) = the corresponding scores’ covariance in two datasets

Variance-Covariance Matrix:

In the variance and covariance matrix, the variance is seen with the diagonal elements whereas the covariance is seen with the off-diagonal elements. So, they both appear together.

V = Σ x12 / N Σ x1 x2 / N. . .Σ x1 xc / N

Σ x2 x1 / N Σ x22 / N. . .Σ x2 xc / N

. . . . . . . . . . . .

Σ xc x1 / N Σ xc x2 / N. . .Σ xc2 / N

V = variance-covariance matrix - a c x c

xi = the “ith” deviation score in scores’s set

N = the scores numbers in each “c”datasets

Σ xi2 / N = the elements’ variance of “ith” data set

Σ xi xj / N = the elements’ covariance for “ith” and “jth” datasets

variance-covariance matrix calculator

There are various online free variance-covariance matrix calculators available for calculation. You will have to enter the matrix in the same manner as the examples' matrices. Calculate the covariance matrix of a multivariate sample by clicking the Calculate! Button.

After adding the matrix information, you will get the answer to the calculation.

You can choose any variance-covariance matrix calculator that you wish is easy to use and provides accurate information.


By understanding the variance-covariance matrix example, you will understand more about "what is a variance-covariance matrix". The term variance-covariance is the statistical term that calculates the standard deviation of a stock portfolio, which portfolio managers then utilize to measure the risk associated with a certain portfolio.

Recent Posts

See All


bottom of page