Contact

Gnumeric · Statistical analysis · Intermediate

Build a Covariance Table in Gnumeric

Use Gnumeric's Covariance analysis tool with aligned observations, correct labels and grouping, and a checked population-covariance example.

Gnumeric 1.12.62 manual and released source reviewed; worked formulas checked by headless ssconvert; graphical tool execution pending · Editorial standards

Gnumeric’s Covariance analysis tool calculates several pairwise covariances in one operation. Use it when your observations contain multiple numeric variables and you want a labeled table rather than separate formulas for every pair.

Two details matter before you start: the 1.12.62 tool uses population covariance, with denominator n, and it fills the lower triangle and diagonal, not both halves of a square matrix. An empty cell above the diagonal is not a zero covariance.

Version and verification: The steps below are qualified to Gnumeric 1.12.62’s English GTK interface, checked against its released menu, dialog and calculation source. Independent arithmetic and headless ssconvert calculations on Debian 13 x86-64 check the example formulas. The graphical Covariance dialog itself was not run, and no screenshot or cross-platform GUI verification is claimed.

Prepare paired numeric data

Enter this synthetic example in A1:C5 on a blank sheet. Each row is one observation of X, Y and Z. Keep the entire row together when sorting or cleaning the data.

Sheet row A B C
1 X Y Z
2 1 2 8
3 2 4 6
4 3 5 4
5 4 9 2

The headings belong in row 1; the twelve data cells in A2:C5 must contain numbers. Do not include a separate observation-ID column, totals row or explanatory notes in the analysis range. Equal-length columns are necessary, but they do not prove that the rows still describe matching observations.

For this first run, use complete numeric data with no blanks, text, Boolean values or formula errors. Do not assume the tool will repair a broken pairing or apply the missing-data policy your analysis requires.

Run the Covariance analysis

  1. Choose Statistics → Descriptive Statistics → Covariance…. In this release, Covariance is under Statistics, not the general Tools menu. The path is established by the released menu structure and English menu labels.
  2. On Input, set Input range to A1:C5. You can type the range or select it on the sheet. A sheet name added by the selector is normal.
  3. Set Grouped by to Columns. There are three variables, one per column. Each observation row contains measurements of those same variables.
  4. Select Labels, because the selected range includes X, Y and Z in its first row.
  5. On Output, choose New sheet. This avoids overwriting source data or clipping results to an undersized output range. Leave Autofit columns enabled for readable headings.
  6. Select Formulæ, rather than Values, in the output-type selector if you want results to recalculate when the existing input cells change. The tool enables formula output by default in 1.12.62. Values are a snapshot; rerun the analysis after changing the source. Neither choice automatically extends a fixed range to include newly appended observations.
  7. Select OK, then check the headings and results against the table below.

The released covariance dialog defines the Input/Output tabs, grouping and Labels controls. The shared output controls define New sheet and the Formulæ/Values choice.

Read the lower-triangular result

The expected output is a four-by-four table including its label row and label column. This is an explanatory table, not a captured Gnumeric result.

Covariances X Y Z
X 1.25
Y 2.75 6.5
Z -2.5 -5.5 5
  • Y row, X column: 2.75. X and Y tend to depart from their own means in the same direction.
  • Z row, X column: −2.5. Z decreases as X increases in this example.
  • Diagonal: 1.25, 6.5 and 5. A variable’s population covariance with itself is its population variance. Unlike a correlation table, the diagonal need not be 1.
  • Upper-triangle blanks are intentional. Covariance is symmetric, so each off-diagonal pair is calculated once. Do not expect a second displayed X–Y value to compare with Y–X, and do not replace the blanks with zeros.

The released table writer and covariance entry point establish this shape. The shipped covariance regression test also specifies a blank upper triangle. That test is source evidence, not a claim that we ran the analysis tool.

If a later calculation requires a full square numeric matrix, keep the original output and complete a copy by reflecting the lower-triangle entries across the diagonal. For the copied table starting at A1, use =B3 in C2, =B4 in D2 and =C4 in D3. Keep the labels outside the numeric matrix B2:D4. This is a manual completion of the symmetric matrix, not an extra Covariance-dialog option.

Check the denominator independently

The X mean is 2.5 and the Y mean is 5. Their centered products are:

Observation X − 2.5 Y − 5 Product
1 -1.5 -3 4.5
2 -0.5 -1 0.5
3 0.5 0 0
4 1.5 4 6

The products sum to 11. With four observations, population covariance is 11 / 4 = 2.75. Sample covariance divides by three instead, giving 11 / 3 ≈ 3.666666667.

On the original data sheet, these formulas provide useful cross-checks:

Formula Expected result Purpose
=COVAR(A2:A5,B2:B5) 2.75 Match the tool’s X–Y population covariance.
=COVAR(B2:B5,A2:A5) 2.75 Check mathematical symmetry independently of the output triangle.
=COVAR(A2:A5,A2:A5) 1.25 Check the X diagonal.
=COVAR(A2:A5,C2:C5) -2.5 Check the negative X–Z covariance.
=COVARIANCE.S(A2:A5,B2:B5) 3.666666667, rounded Calculate the different sample estimator.

Do not infer the denominator from the tool’s name. In the released source, the tool explicitly calls COVAR; that function’s implementation selects the population calculator, whose arithmetic divides by n. The dialog has no population/sample selector. Use COVARIANCE.S formulas when your analysis requires the sample estimator.

For these complete, identically paired data, every sample-covariance entry is the corresponding population entry multiplied by 4/3. Do not apply that shortcut blindly when different pairs have different valid observations.

When variables run across rows

Grouping describes where each variable lives, not whether the sheet looks wider or taller.

  • Columns: with the example in A1:C5, each column is a variable. Labels removes its first row from the numeric range.
  • Rows: if you instead place X and its four readings across A1:E1, Y across A2:E2, and Z across A3:E3, select A1:E3, choose Rows, and enable Labels. The label is now the first column of each row. The same paired measurements should give the same expected covariances.
  • Areas: the dialog also accepts separate ranges as variables. This guide does not test multi-column area layout or its label-removal edge cases. Use the contiguous column or row arrangements above unless you have verified how your area selection maps corresponding observations.

Without headings, select only the numeric cells and leave Labels off. The tool generates names such as Column 1 or Row 1. Turning Labels on for a heading-free range excludes the first observation of each variable; it does not merely change the displayed heading.

Troubleshooting

Problem What to check or change
Only two variables appear Include all three columns: A1:C5, not A1:B5. The official manual’s older example describes three variables but prints a two-column range; do not copy that range for a three-variable analysis.
Too many variables appear The selected rows were probably treated as separate variables. Use Columns for the supplied layout, and exclude ID columns or other nonmeasurement fields.
The result uses numbers as headings Check whether Labels was enabled without including a header row or column. Reselect the intended complete range.
An unequal-size input warning appears Match the lengths of the selected variable ranges and include or exclude headings consistently. The released tool checks sizes before generating output. Do not pad missing measurements with invented zeros.
My value is 3.666666667, not 2.75 Check whether you used COVARIANCE.S or another sample estimator. This tool’s result uses n, not n − 1.
The upper-right cells are blank That is the documented-by-source lower-triangle layout, not a failed calculation. Mirror the opposite entries only if your downstream calculation needs a full matrix.
The results do not change after an edit Check whether output was Values, or whether the edited cell lies outside the fixed input range. Rerun with Formulæ and the correct range if live results are required.
A result is unexpected or an error appears Check actual numeric types, formula errors, exact range endpoints and row pairing. Clean the data on a copy and decide your missing-data rule explicitly. This guide does not certify mixed-data omission behavior.

Covariance has the product of the variables’ units. Rescaling only one member of a pair from dollars to cents multiplies that pair’s covariance by 100; that variable’s own variance becomes 10,000 times as large. A large absolute value is not automatically a stronger association across differently scaled variables. Use CORREL when you need a dimensionless measure of linear association, and inspect the data for outliers. Neither covariance nor correlation proves causation.

Check boundary: The example’s six lower-triangle COVAR values, its reversed X–Y formula and the sample comparison were recalculated with Gnumeric 1.12.62’s headless spreadsheet engine after removing formula caches. This verifies those formulas on the stated complete numeric data, not selection, dialog submission or matrix creation through the graphical tool.