Free online tools to generate, calculate,
convert, format, encode, and play.
 

Correlation Coefficient

Calculate correlation between two variables and visualize their relationship.


Enter Your Data
Enter the same number of values for both variables. Values can be separated by commas, spaces, or new lines.
Results update as you type.
Example Datasets:

How It Works

What is Correlation?

Correlation measures the strength and direction of the linear relationship between two variables. It tells us how changes in one variable are associated with changes in another.

Pearson's Correlation Coefficient (r)

The most common correlation measure, ranging from -1 to +1:

r = Σ[(X - X̄)(Y - Ȳ)] / √[Σ(X - X̄)² × Σ(Y - Ȳ)²]

Or equivalently: r = Cov(X,Y) / (σ_X × σ_Y)

Interpreting Correlation Values
r Value Strength Meaning
+0.9 to +1.0 Very Strong Positive Y increases strongly as X increases
+0.7 to +0.9 Strong Positive Y tends to increase as X increases
+0.4 to +0.7 Moderate Positive Positive relationship, but variable
+0.1 to +0.4 Weak Positive Slight positive relationship
-0.1 to +0.1 None / Very Weak No linear relationship
-0.1 to -0.4 Weak Negative Slight negative relationship
-0.4 to -0.7 Moderate Negative Negative relationship, but variable
-0.7 to -0.9 Strong Negative Y tends to decrease as X increases
-0.9 to -1.0 Very Strong Negative Y decreases strongly as X increases
Coefficient of Determination (r²)

R-squared represents the proportion of variance in Y that can be explained by X:

r² = (correlation)²

  • r² = 0.81: 81% of Y's variation is explained by X
  • r² = 0.36: 36% of Y's variation is explained by X
  • r² = 0.04: Only 4% of Y's variation is explained by X
Important Notes
  • Correlation ≠ Causation: Just because two variables are correlated doesn't mean one causes the other
  • Linear relationships only: Pearson's r measures linear relationships. Non-linear patterns may have r ≈ 0
  • Outliers matter: Extreme values can greatly affect correlation
  • Sample size: Larger samples give more reliable correlations
Real-World Examples
Variables Typical r Relationship
Height and Weight +0.6 to +0.8 Taller people tend to weigh more
Study Time and Test Scores +0.4 to +0.7 More study correlates with higher scores
Age of Car and Value -0.7 to -0.9 Older cars are worth less
Temperature and Ice Cream Sales +0.7 to +0.9 Sales increase with temperature
Shoe Size and IQ ~0 No meaningful relationship
Step-by-Step Calculation

Example: Calculate correlation for X = [1, 2, 3, 4, 5] and Y = [2, 4, 5, 4, 5]

  1. Calculate means: X̄ = 3, Ȳ = 4
  2. Calculate deviations: (X - X̄) = [-2, -1, 0, 1, 2], (Y - Ȳ) = [-2, 0, 1, 0, 1]
  3. Multiply deviations: [4, 0, 0, 0, 2]
  4. Sum products: Σ = 6
  5. Calculate Σ(X - X̄)² = 10, Σ(Y - Ȳ)² = 6
  6. r = 6 / √(10 × 6) = 6 / 7.746 ≈ 0.775
Applications
  • Finance: Portfolio diversification (low correlation = better diversification)
  • Medicine: Relationship between risk factors and diseases
  • Psychology: Relationships between personality traits and behaviors
  • Economics: Income vs spending, supply vs demand
  • Marketing: Advertising spend vs sales
  • Education: Study habits vs academic performance

Embed This Util

You can embed this util on your own site as a widget. Adding ?embed=1 to the URL loads a compact version with just the tool itself; no header, menu, or documentation. Paste this snippet into your HTML:


    

Copy snippet Adjust the height to taste.



Feedback

Help us improve this page by providing feedback, and include your name/email if you want us to reach back. Thank you in advance.


Share with