ARBIMETRA · Financial intelligence, made practical.

ARBIMETRA LAB

Covariance Analysis

Shows how variables move together in their original units, with sample and population matrices.

What it does

Shows how variables move together in their original units, with sample and population matrices.

Use it as an input to portfolio risk and multivariate methods.

Data you need

  • Two or more numeric variables

Supported data: Numeric. Level: Beginner.

Formula and method

Cov(x,y) = Σ(x−x̄)(y−ȳ) / (n−1)

Each value is taken as a deviation from its mean, and pairs of deviations are multiplied and summed. Dividing by n − 1 gives the sample covariance, and by n the population covariance, across rows complete on all variables.

Assumptions

  • Observations are paired

Input checks

  • Listwise-complete rows
  • Missing rows need confirmation

How to read the result

The sign gives direction. The size depends on units, so compare pairs using correlation.

Worked example

Illustrative run on Simulated study data (teaching data). These figures are the actual output of this model on that example, and they say nothing about your own data.

  • The largest sample covariance in absolute size is 72.5876, between pre_score and post_score.
  • pre_score and post_score tend to move in the same directions.

Limitations

  • Magnitudes are not comparable across different units

Numerical validation

Validated 15 of 15 automated checks passed, including numerical results, invalid input, missing values, small samples, constant variables, charts and the interpretation text.

CheckReferenceResultAbs. errorToleranceSource
Anscombe sample covariance5.5015.5018.9e-161e-3Anscombe (1973) by calculation
Sample against NumPy5.5015.5010.0e+01e-12Independent NumPy calculation
Population against NumPy5.000909095.000909090.0e+01e-12Independent NumPy calculation

Computed with python 3.13.2, numpy 2.2.5, scipy 1.14.1, pandas 2.3.3, statsmodels 0.14.4, scikit-learn 1.7.0, in your browser. A passing check confirms the listed comparison only. It does not make any result suitable for your data, and it is not a claim of equivalence with other statistical software.

Questions

Why is my covariance so large?

Covariance is in the product of the two variables' units, so large units give large values. Correlation removes the units.

ARBIMETRA LAB is an educational and research tool. Results should be checked by the researcher and are not professional advice.