How to make a covariance matrix
- Copy the variable columns together with the header.
- Select 2 or more columns to use.
- Press Analyze and check the heatmap and interpretation. Hover over a cell to see the exact value.
Worked example with sample data
The sample data are the same 30 rows of process data as the correlation matrix (temperature, pressure, line speed, thickness, strength).
The diagonal holds the variance of each variable: strength 569.31, temperature 18.49, line speed 2.64, pressure 0.10, thickness 0.02. Strength has the largest variance because of its large unit (MPa), so the cells related to strength take up most of the color range.
The largest off-diagonal covariance is temperature-strength at 76.17 (positive direction). Yet the strongest relationship in the correlation matrix was line speed-thickness (r=-0.92), whose covariance is only -0.20. The size of a covariance depends on scale, so use the correlation matrix to compare strength.
The pressure-thickness cell shows 0.00, but the actual value is a very small 0.0045. Hover over the cell to see the exact value.
How it is calculated
Each cell is the sample covariance (divided by n-1) of the two columns, and the diagonal is the sample variance of that column. Missing values are handled pair by pair (pairwise, the same as pandas .cov()). Cells show two decimals, so small values may appear as 0.00 - hover to see the exact value.
Difference from the correlation matrix
A covariance matrix keeps the units and scale of each variable, so variables with large values (for example strength in MPa) tend to dominate the colors. To compare the strength of relationships, look at the unit-free correlation matrix too.
How to read a covariance matrix
- The interpretation names the off-diagonal covariance with the largest absolute value and its direction (positive/negative).
- The square root of a diagonal value (variance) is that variable's standard deviation.
- A large covariance does not mean a strong relationship. The larger the scale of a variable, the larger its covariances.
Frequently asked questions
Can I see the population covariance (divided by n)?
Only the sample covariance (n-1) is provided. Multiply by (n-1)/n if you need the value divided by n.
Can I move the matrix values to Excel?
Hover over a cell to see the exact value, and save or copy the chart as an image.