ARBIMETRA · Financial intelligence, made practical.

ARBIMETRA LAB

Correlation Analysis

Measures linear and rank association between pairs of variables, with p-values, intervals, a matrix and a heatmap.

What it does

Measures linear and rank association between pairs of variables, with p-values, intervals, a matrix and a heatmap.

Use it to explore relationships. Choose Spearman or Kendall for ranks or when outliers and curvature are a concern.

Data you need

  • Two or more numeric variables

Supported data: Numeric. Level: Beginner.

Formula and method

r = Σ(x−x̄)(y−ȳ) / √[Σ(x−x̄)² Σ(y−ȳ)²]

Pearson correlates the raw values. Spearman correlates their ranks. Kendall counts concordant and discordant pairs with a tie correction. Each pair of variables uses every row complete on both, and confidence intervals use the Fisher z transformation.

Assumptions

  • Pearson: a linear relationship
  • Observations are independent

Input checks

  • Pairs use rows complete on both variables
  • At least 4 pairs
  • Constant variables are rejected

How to read the result

The sign gives direction and the size gives strength. Always look at the scatterplot.

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 strongest pearson association is between pre_score and post_score: r = 0.6063, p = <0.0001, n = 240.
  • That association is moderate and positive: statistically significant at the 5% level.

Limitations

  • Correlation does not establish causation
  • Pearson misses non-linear relationships

Numerical validation

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

CheckReferenceResultAbs. errorToleranceSource
Anscombe I Pearson r0.816420520.816420524.4e-161e-9Anscombe (1973); independent NumPy
Spearman equals Pearson on ranks0.818181820.818181820.0e+01e-11Independent NumPy calculation
Kendall by pair enumeration0.636363640.636363640.0e+01e-11Independent NumPy calculation
Pearson p-value from t0.002169630.002169631.6e-171e-7Independent 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

Pearson or Spearman?

Pearson measures linear association between numeric values. Spearman works on ranks, so it suits monotonic relationships and is less affected by outliers.

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