Skip to content
ENExplore Calculators

Correlation Calculator

Calculate the Pearson correlation coefficient between two features in a dataset.

About Correlation Calculator

The Pearson correlation coefficient measures the strength and direction of a linear relationship between two variables: r = cov(X,Y) / (std_x × std_y), always in the range [-1, 1]. r = 1 means a perfect positive linear relationship, r = -1 means a perfect negative linear relationship, and r = 0 means no linear relationship. In ML, correlation is widely used for feature selection (dropping one of a pair of highly correlated features to reduce redundancy/multicollinearity) and for exploratory data analysis.

Formula

r = cov(X, Y) / (std_x × std_y)

cov(X, Y)
Sample covariance of X and Y
std_x
Standard deviation of X
std_y
Standard deviation of Y

Worked example

With the default values below, Correlation Calculator returns Pearson Correlation (r) of 0.975953. Change any input above and every figure here is recalculated in your browser.

Inputs used

Series X
2, 4, 6, 8, 10
Series Y
3, 7, 8, 15, 20

Results

Pearson Correlation (r)
0.975953
R² (Coefficient of Determination)
0.952484
Direction
Positive
Relationship Strength
Very strong

Step by step

  1. 1cov(X,Y)= 21.0000
  2. 2std(X), std(Y)= 3.1623, 6.8044
  3. 3r = cov(X,Y) ÷ (std_x × std_y)= 0.975953

Assumptions and limits

  • The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 6 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

What does R² tell me beyond r?

R² (r squared) represents the proportion of variance in one variable that is explained by a linear relationship with the other — e.g. r = 0.8 gives R² = 0.64, meaning 64% of the variance is 'explained' by the linear relationship.

Why might two features have high correlation but low usefulness for ML?

Pearson correlation only captures linear relationships — two variables can have a strong nonlinear relationship (e.g. quadratic) and still show low or zero Pearson correlation, so it should be complemented with visualization or nonlinear correlation measures like Spearman's rank correlation.

How is correlation used for feature selection?

Highly correlated feature pairs (e.g. |r| > 0.9) often carry redundant information; removing one of the pair can reduce multicollinearity in linear models and slightly simplify the model without losing much predictive power.

Does correlation imply causation?

No — a strong correlation between two variables does not establish that one causes the other; both could be driven by a third confounding variable, or the relationship could be coincidental in a small sample.

Correlation Calculator (AI & ML) | Calcrivo