Statistics

Correlation Calculator

Find correlation coefficient. Fast, accurate, and completely free.

Favorites

Recent Tools

Results
Pearson Correlation (r)
R² (Determination)
Covariance
Regression Equation
Slope (m)
Intercept (b)
n (pairs)
Mean X / Mean Y

Mathematical Formula

r = \frac{n\sum xy - \sum x \sum y}{\sqrt{[n\sum x^2 - (\sum x)^2][n\sum y^2 - (\sum y)^2]}}

r = Pearson correlation coefficient (−1 to +1)

= Coefficient of determination = r²

m = Slope of regression line = [nΣxy − ΣxΣy] / [nΣx² − (Σx)²]

b = Y-intercept = ȳ − m·x̄

How to Use this Calculator

  1. Enter your X values (independent variable) as comma-separated numbers.

  2. Enter the corresponding Y values (dependent variable) in the same order.

  3. Ensure both datasets have the same number of values.

  4. Click Calculate to see the Pearson correlation coefficient, R², regression equation, and scatter plot.

  5. Interpret the strength: |r| < 0.3 is weak, 0.3–0.7 is moderate, > 0.7 is strong.

Understanding Correlation and Linear Regression

Correlation measures the strength and direction of the linear relationship between two variables. The Pearson correlation coefficient (r) ranges from −1 (perfect negative linear relationship) through 0 (no linear relationship) to +1 (perfect positive linear relationship). It is one of the most widely used statistics in research and data analysis.

Pearson Correlation Coefficient (r)

The Pearson r quantifies the degree to which two continuous variables move together linearly. A value of r = 0.95 indicates a very strong positive relationship — as one variable increases, the other reliably increases in a proportional manner. Conversely, r = −0.85 indicates a strong negative (inverse) relationship.

Interpreting Correlation Strength

As a general guideline: |r| < 0.3 represents a weak correlation, 0.3 ≤ |r| < 0.7 is moderate, and |r| ≥ 0.7 is strong. However, interpretation should always consider the context. In social sciences, r = 0.5 may be remarkably strong, while in physics, r = 0.95 might be considered weak.

R-Squared: Coefficient of Determination

R² = r² tells you the proportion of variance in the dependent variable (Y) that is explained by the independent variable (X) through the linear model. An R² of 0.81 means that 81% of the variability in Y can be accounted for by X. The remaining 19% is unexplained variance.

Linear Regression: y = mx + b

Simple linear regression fits a straight line through the data points that minimizes the sum of squared residuals (ordinary least squares). The slope (m) tells you how much Y changes for each one-unit increase in X. The intercept (b) is the predicted value of Y when X = 0. Together, they form the regression equation used for prediction.

Covariance

Covariance measures how two variables change together. Unlike correlation, covariance is not standardized, so its magnitude depends on the units of the variables. Correlation is essentially a normalized version of covariance, making it more interpretable across different datasets.

Caution: Correlation ≠ Causation

A strong correlation between two variables does not imply that one causes the other. There may be confounding variables, reverse causation, or coincidental relationships. Always combine statistical analysis with domain knowledge before drawing causal conclusions.

Frequently Asked Questions (FAQ)

What if my X and Y arrays have different lengths?

Both arrays must have the same number of values, as each X value must be paired with a corresponding Y value. The calculator will show an error if the lengths do not match.

Does correlation work for non-linear relationships?

Pearson correlation measures only linear relationships. Data with a perfect quadratic relationship might show r ≈ 0. For non-linear relationships, consider Spearman's rank correlation or polynomial regression.

What does a negative correlation mean?

A negative r means that as one variable increases, the other tends to decrease. For example, hours of TV watched and exam scores might have a negative correlation.

How many data points do I need?

Technically, you need at least 3 data points, but correlation estimates with very few points are unreliable. For meaningful results, aim for at least 20–30 data pairs.

What is the difference between R and R²?

R (Pearson r) measures the strength and direction of linear association (−1 to +1). R² is the square of r (0 to 1) and represents the proportion of variance in Y explained by X.

Explore more tools you might find useful