How to Create a Covariance Matrix in SPSS

Covarianceis a measure of how changes in one variable are associated with changes in a second variable. Specifically, it’s a measure of the degree to which two variables are linearly associated.

The formula to calculate the covariance between two variables,XandYis:

COV(X,Y)= Σ(x-x)(y-y) / n

Acovariance matrixis a square matrix that shows the covariance between different variables in a dataset.

This tutorial explains how to create a covariance matrix for a given dataset in SPSS.

Example: Covariance Matrix in SPSS

Suppose we have the following dataset that shows the test scores of 10 different students for three subjects: math, science, and history:

To create a covariance matrix for this dataset, click theAnalyzetab, thenCorrelate, thenBivariate:

In the new window that pops up, drag each of the three variables into the box labelledVariables:

Next, clickOptions. Check the box next toCross-product deviations and covariances. Then clickContinue.

Then clickOK. The output will appear in a new window:

Covariance matrix in SPSS

To obtain the covariance for each pairwise combination of variables, you must divide theSum of Squares and Cross-productsbyN.

For example, the covariance between math and science can be calculated as:

COV(math, science) = 332.000 / 10 =33.2.

Similarly, the covariance between math and history can be calculated as:

COV(math, history) = -244.400 / 10 = -24.44.

You can also obtain the variance for each variable by dividingtheSum of Squares and Cross-productsbyN.

For example, the variance for math can be calculated as:

VAR(math) = 649.600 / 10 = 64.96.

You can obtain the entire covariance matrix for this dataset by performing similar calculations:

Covariance matrix in SPSS

How to Interpret a Covariance Matrix

The values along the diagonals of the covariance matrix are simply the variances of each subject. For example:

  • The variance of the math scores is 64.96.
  • The variance of the science scores is 56.4.
  • The variance of the history scores is 75.56.

The other values in the matrix represent the covariances between the various subjects. For example:

  • The covariance between the math and science scores is 33.2.
  • The covariance between the math and history scores is -24.44.
  • The covariance between the science and history scores is -24.1.

Apositive numberfor covariance indicates that two variables tend to increase or decrease in tandem. For example, math and science have a positive covariance (33.2), which indicates that students who score high on math also tend to score high on science. Likewise, students who score low on math also tend to score low on science.

Anegative numberfor covariance indicates that as one variable increases, a second variable tends to decrease. For example, science and history have a negative covariance (-24.1), which indicates that students who score high on science tend to score low on history. Likewise, students who score low on science tend to score high on history.

Additional Resources

How to Create a Correlation Matrix in SPSS
How to Calculate Partial Correlation in SPSS

  • https://r-project.org
  • https://www.python.org/
  • https://www.stata.com/

Deja un comentario

Puede usar la siguiente sintaxis para eliminar filas que contienen una determinada cadena en un marco de datos en R:…
statologos comunidad-2

Compartimos información EXCLUSIVA y GRATUITA solo para suscriptores (cursos privados, programas, consejos y mucho más)

You have Successfully Subscribed!