Skip to main content

Correlation Calculator

Calculate Pearson correlation coefficient between two datasets.

Reviewed for accuracy by the Math Ora X team Last updated

Result

About Correlation Calculator

Pearson's correlation coefficient measures linear relationship between two variables. r = 1 is perfect positive, r = -1 is perfect negative.

$$r = \frac{\sum(x_i-\bar{x})(y_i-\bar{y})}{\sqrt{\sum(x_i-\bar{x})^2 \sum(y_i-\bar{y})^2}}$$

How to use this calculator

  1. Enter the two datasets as matched pairs, with each \(x_i\) lined up to the corresponding \(y_i\).
  2. Check that both lists have the same number of values, because each pair is used together in the calculation.
  3. Submit the data to compute Pearson’s \(r\), which will be between \(-1\) and \(1\).
  4. Read the result and the step-by-step work to see how the averages, deviations, and final ratio are formed.

The formula explained

The formula computes the correlation coefficient \(r\), which compares how the two variables vary together against how much each variable varies on its own. A value near \(1\) means a strong positive linear relationship, near \(-1\) means a strong negative linear relationship, and near \(0\) means little or no linear relationship.

  • r = Pearson correlation coefficient
  • \(x_i\) = the \(i\)-th value in the first dataset
  • \(y_i\) = the \(i\)-th value in the second dataset
  • \(\bar{x}\) = the mean of the \(x\)-values
  • \(\bar{y}\) = the mean of the \(y\)-values

Step by step method

  1. Find the mean of the \(x\)-values and the mean of the \(y\)-values.
  2. For each pair, subtract the mean from each value to get deviations, then multiply the paired deviations and also square each deviation.
  3. Add the paired products and the squared deviations, then divide the total paired product by the square root of the product of the two squared-deviation sums.

Worked example

Problem. Find the Pearson correlation coefficient for the paired data \((1,2), (2,3), (3,5), (4,4)\).

  1. Compute the means: \(\bar{x} = (1+2+3+4)/4 = 2.5\), \(\bar{y} = (2+3+5+4)/4 = 3.5\).
  2. Find deviations and products: \((-1.5)(-1.5)=2.25\), \((-0.5)(-0.5)=0.25\), \((0.5)(1.5)=0.75\), \((1.5)(0.5)=0.75\). The sum of products is \(4.0\). Also, \(\sum(x_i-\bar{x})^2 = 2.25+0.25+0.25+2.25 = 5\), and \(\sum(y_i-\bar{y})^2 = 2.25+0.25+2.25+0.25 = 5\).
  3. Compute \(r = 4 / \sqrt{5\cdot 5} = 4/5 = 0.8\).

Answer. \(r = 0.8\)

Tips and common mistakes

  • Correlation only measures linear relationship, so a curved pattern can have a low \(r\) even if the variables are related.
  • Make sure the data are paired correctly, because switching one value to the wrong partner changes the result completely.

Frequently asked questions

How do I use the correlation calculator?+

Enter the two datasets as paired x and y values, with each x matched to the corresponding y in the same row or position. The calculator then finds the Pearson correlation coefficient, r, and shows the steps used to compute it.

What does the Pearson correlation coefficient r mean?+

The value of r measures the strength and direction of a linear relationship between two variables. An r near 1 means a strong positive relationship, an r near -1 means a strong negative relationship, and an r near 0 means little or no linear relationship.

What formula does the calculator use?+

It uses the Pearson correlation formula, r equals the sum of the products of each x and y deviation from their means, divided by the square root of the product of the squared x deviations and squared y deviations. In symbols, r = sum((x_i - x̄)(y_i - ȳ)) / sqrt(sum((x_i - x̄)^2) sum((y_i - ȳ)^2)).

What if my data have only one pair, repeated values, or different lengths?+

Pearson correlation requires at least two paired data points, and the x and y lists must have the same number of entries. If all x values or all y values are identical, the denominator becomes zero, so r is undefined.

How is correlation different from causation or from covariance?+

Correlation only describes how two variables move together, it does not prove that one causes the other. Covariance also measures joint variation, but correlation standardizes that value, so r is easier to compare because it always falls between -1 and 1.

More Mathematics Tools

Explore related calculators in this category

You Might Also Like

Popular tools from other categories

Can't Find the Right Calculator?

Try our AI Math Solver, type any problem in plain English and get instant step-by-step solutions.

Try AI Solver

Browse All Categories

Home Mathematics Current Tool
Facebook Twitter WhatsApp