Pearson Correlation Calculator

Compute the Pearson correlation coefficient (r) and coefficient of determination (R²) for paired data. Visualize the linear relationship with an interactive scatter plot and regression line. Accurate hypothesis testing with t-statistic & p-value.

Supports decimals, negative values. Delimiters: comma, space, or newline.
Must have the same number of observations as X.
? Positive strong (r≈1): X:1,2,3,4,5 ; Y:2,4,6,8,10
? Negative strong: X:1,2,3,4,5 ; Y:10,8,6,4,2
? Weak correlation: X:1,2,3,4,5 ; Y:5,3,4,6,2
? Nonlinear (r near zero): X:1,2,3,4,5 ; Y:1,4,9,16,25
? Real estate: X:Area(1000 sqft):0.8,1.2,1.5,1.8,2.1 ; Y:Price($k):180,230,290,340,400
Privacy-first – All calculations are performed locally in your browser. No data is uploaded or stored.

What is the Pearson Correlation Coefficient?

The Pearson correlation coefficient (denoted r) measures the strength and direction of the linear relationship between two continuous variables. Ranges from -1 to +1: r = 1 indicates a perfect positive linear relationship, r = -1 a perfect negative linear relationship, and r = 0 implies no linear correlation. Developed by Karl Pearson in the late 19th century, it remains the most widely used bivariate correlation measure in statistics, psychology, finance, and natural sciences.

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

The numerator is the covariance of x and y (scaled), while the denominator standardizes the measure. This produces a unitless coefficient that is invariant to linear transformations of the variables.

Interpreting the Correlation Strength

|r| range Interpretation Typical example
0.00 – 0.19 Very weak / negligible Random noise relationship
0.20 – 0.39 Weak correlation Modest tendency
0.40 – 0.59 Moderate correlation Noticeable linear trend
0.60 – 0.79 Strong correlation Consistent linear association
0.80 – 1.00 Very strong correlation Almost deterministic linear pattern

Important: Correlation does not imply causation. Two variables may be highly correlated without a direct causal link (e.g., ice cream sales and drowning incidents). Always combine correlation analysis with domain knowledge.

Case Study: Education & Income Correlation

A socioeconomic study based on 50 individuals collected years of education (X) and annual income in USD (Y: 35k, 48k, 62k, …). The Pearson correlation was r = 0.78 (p < 0.001), indicating a strong positive linear relationship between education and income. The regression line predicted a $5,200 increase in income per additional year of education. However, confounding factors like work experience and geographic location were also relevant, showcasing the need for multiple regression.

Hypothesis Testing and p-value

When computing r from a sample, we often test whether the true population correlation ρ is zero. The test statistic follows a t-distribution with n-2 degrees of freedom: t = r * sqrt((n-2)/(1-r²)). A low p-value (typically less than 0.05) rejects the null hypothesis of no correlation. Our calculator provides the exact two-tailed p-value using the cumulative t-distribution (implemented via the incomplete beta function, accuracy within 1e-6 compared to R's cor.test).

Assumptions & Limitations

  • Linearity: Pearson r only captures linear relationships. Nonlinear patterns (e.g., quadratic, sinusoidal) may produce r close to zero even with a strong association.
  • Bivariate normality: Reliable inference assumes that the pair (X,Y) follows a bivariate normal distribution, though r is robust for moderate departures.
  • No outliers: Outliers can drastically inflate or deflate r. Always inspect the scatter plot.
  • Homoscedasticity: The spread of Y around the regression line should be roughly constant across X.

✅ Tip: Before computing Pearson’s r, always visualize your data. The scatter plot reveals outliers, clusters, and non‑linear patterns that the coefficient alone cannot detect.

Frequently Asked Questions

There is no absolute threshold – it depends on your field. In social sciences, r > 0.3 may be considered meaningful; in physical sciences, r > 0.9 is often expected. Context matters.

No, mathematically r lies between -1 and 1 inclusive. Values outside this range indicate a calculation error.

The calculator will show an error. Both X and Y must have the same number of observations. Missing or mismatched values break the pairing.

R² represents the proportion of variance in Y explained by X. For example, r=0.8 gives R²=0.64, meaning 64% of the variation in Y is explained by the linear relationship with X.

Yes. Spearman’s rho is a non‑parametric alternative based on ranks and works for monotonic relationships without normality assumptions. Pearson is more sensitive to outliers and linearity.

The slope of the regression line is b = r * (s_y / s_x). The sign of r and slope always match. The line minimizes the sum of squared residuals.

Algorithm & accuracy statement – This calculator implements the standard Pearson product-moment correlation formula (Pearson, 1896). The p-value is derived from the t-distribution using a numerically stable incomplete beta function (based on the continued fraction method by Didonato & Morris, 1992). The implementation has been cross-validated against R's cor.test() for sample sizes ≥3, showing absolute error below 1e-6. No personal or team credentials are claimed; the tool is provided as an open statistical reference. For critical research, always verify with dedicated software.

References: Wolfram MathWorld | NIST Manual | Pearson Correlation in Medical Research