R Score in Statistics: Correlation Coefficient Explained
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
This page explains the r score in statistics, more formally known as the Pearson correlation coefficient. You enter two paired lists of numbers (for example, height and weight for a group of people), and the calculator returns a value between -1 and +1 that measures the strength and direction of their linear relationship. A score near +1 means a strong positive association, near -1 means a strong negative association, and near 0 means little or no linear association.
Formula
The Pearson correlation coefficient is computed with this formula:
r = [ n·Σxy − (Σx)(Σy) ] / √( [ n·Σx² − (Σx)² ] · [ n·Σy² − (Σy)² ] )
Where:
- n = number of paired observations (pairs of x and y)
- Σxy = sum of the products of each x multiplied by its paired y
- Σx = sum of all x values
- Σy = sum of all y values
- Σx² = sum of each x squared
- Σy² = sum of each y squared
All sums are taken over the n pairs. The result is a dimensionless number (no units) between −1 and +1.
Worked Example
Using the default values from the calculator: x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 5.
- n = 5
- Σx = 1+2+3+4+5 = 15
- Σy = 2+4+5+4+5 = 20
- Σxy = (1×2)+(2×4)+(3×5)+(4×4)+(5×5) = 2+8+15+16+25 = 66
- Σx² = 1+4+9+16+25 = 55
- Σy² = 4+16+25+16+25 = 86
- Numerator = 5×66 − 15×20 = 330 − 300 = 30
- Denominator = √[(5×55 − 15²) × (5×86 − 20²)] = √[(275 − 225) × (430 − 400)] = √(50 × 30) = √1500 ≈ 38.7298
- r = 30 / 38.7298 ≈ 0.7746
The calculator rounds to 4 decimals, so it shows r = 0.7746. The coefficient of determination is r² = 0.7746² ≈ 0.6000, meaning about 60% of the variance in y is explained by x in this small sample.
When to Use the r Score
The r score is used when you have two continuous (numeric) variables and want to know if they move together in a straight-line fashion. Common applications include:
- Test scores vs. study hours
- Temperature vs. ice cream sales
- Age vs. blood pressure in a medical study
- Advertising spend vs. revenue
It only measures linear relationships. If the true relationship is curved (e.g., quadratic), r may be close to 0 even though a strong pattern exists. Always plot your data first to check for curvature.
How to Read the Result
The sign tells you the direction: positive means as x increases, y tends to increase; negative means as x increases, y tends to decrease. The magnitude tells you the strength:
- |r| ≥ 0.8: strong linear relationship
- 0.5 ≤ |r| < 0.8: moderate
- 0.2 ≤ |r| < 0.5: weak
- |r| < 0.2: very weak or no linear relationship
These thresholds are rough guidelines; the practical meaning depends on your field. For example, in psychology, r = 0.3 might be considered meaningful, while in physics, r = 0.99 is expected for a well-behaved law.
Remember: correlation does not imply causation. Two variables can be highly correlated because both are driven by a third factor (e.g., ice cream sales and drowning deaths both rise in summer).
Common Mistakes and Limitations
- Unit mix-ups: r is unitless, so it doesn’t matter whether you use cm or inches, but the data must be paired correctly. Mixing up which x goes with which y will give a wrong result.
- Outliers: A single extreme point can inflate or deflate r dramatically. Always check a scatterplot.
- Non-linear relationships: r can be near 0 for a perfect U-shaped curve. Use other methods if you suspect non-linearity.
- Restricted range: If you only sample a narrow slice of x values, r may underestimate the true correlation in the full population.
- Rounding too early: In the formula, keep intermediate sums with full precision. Rounding Σx² or Σxy too early can change the final r noticeably.
Alternatives to Pearson’s r
When your data violates the assumptions of Pearson’s r (linearity, no serious outliers, roughly normal distribution), consider these alternatives:
- Spearman’s rank correlation (ρ): Uses ranks instead of raw values. It measures monotonic relationships (not necessarily linear) and is robust to outliers.
- Kendall’s tau (τ): Another rank-based method, often used for small samples or when many ties exist.
- Point-biserial correlation: Used when one variable is dichotomous (e.g., pass/fail) and the other is continuous.
- Polychoric correlation: For two ordinal variables that are assumed to have an underlying continuous distribution.
For most introductory statistics, Pearson’s r is the default, but always check the shape of your data first.
Frequently Asked Questions
What does an r score of 0 mean?
An r of 0 means there is no linear relationship between the two variables. It does not mean they are independent – they could have a strong curved relationship (like y = x²) that r simply doesn’t capture.
Can r be greater than 1 or less than −1?
No. The formula is constructed so that r always falls between −1 and +1. If you get a value outside that range, you have an arithmetic error – often a sign mistake or a mis-entered data point.
What is the difference between r and R²?
r is the correlation coefficient (between −1 and +1). R² (or r² for simple linear regression) is the coefficient of determination, which equals r² and ranges from 0 to 1. It tells you the proportion of variance in one variable explained by the other. For example, r = 0.8 gives R² = 0.64, so 64% of the variance is shared.
Is r score the same as p-value?
No. r measures the strength and direction of the relationship. The p-value tests whether the observed r is statistically significantly different from 0, given the sample size. A large r from a tiny sample might not be significant, while a small r from a huge sample can be.
Can I use r for non-numeric data?
No, Pearson’s r requires two numeric variables. For ordinal data (like rankings), use Spearman’s rho. For nominal categories, use other measures like Cramér’s V.
Why does my calculator show r = 0.7746 for the default data?
That’s the correct Pearson correlation for the pairs (1,2), (2,4), (3,5), (4,4), (5,5). The positive value indicates a moderate-to-strong positive relationship, and 0.7746² ≈ 0.60 means about 60% of the variation in y is linearly explained by x.
Related
Formula used
in x | X values | - | 1,2,3,4,5 | 0 in y | Y values | - | 2,4,5,4,5 | 0 out r | Correlation coefficient r | - | (count(x)*sum(x*y)-sum(x)*sum(y)) / sqrt((count(x)*sum(x^2)-sum(x)^2)*(count(y)*sum(y^2)-sum(y)^2)) | 4 out r2 | Coefficient of determination r² | - | r^2 | 4
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.