Correlation Analysis
Measure and interpret linear relationships between continuous variables using Pearson and Spearman correlations, and understand why correlation does not equal causation.
You'll learn
How to measure the strength and direction of relationships between continuous variables.
Use this when
You want to know if age, BMI, or lab values are related to each other.
What Correlation Measures
Correlation measures the strength and direction of the linear relationship between two continuous variables. The correlation coefficient (r or ρ) ranges from -1 to +1.
- ●r = +1: Perfect positive linear relationship (as X increases, Y increases proportionally)
- ●r = 0: No linear relationship
- ●r = -1: Perfect negative linear relationship (as X increases, Y decreases proportionally)
- ●r = 0.3: Weak positive, r = 0.5: Moderate positive, r = 0.7: Strong positive
Pearson vs. Spearman Correlation
There are two main types of correlation coefficient:
- ●Pearson r: Parametric. Measures linear relationship. Requires both variables to be continuous and approximately normally distributed. Sensitive to outliers.
- ●Spearman ρ (rho): Nonparametric. Measures monotonic (not necessarily linear) relationship using ranks. Works for ordinal data and when normality is violated. More robust to outliers.
- ●In practice: Use Pearson if data is normal and continuous; use Spearman if skewed, ordinal, or if outliers are present.
R² — Coefficient of Determination
R² (r squared) is the proportion of variance in one variable explained by the other. It is a more intuitive measure of effect size than r alone.
- ●r = 0.5 → R² = 0.25 → 25% of variance in Y is explained by X
- ●r = 0.7 → R² = 0.49 → 49% of variance explained
- ●r = 0.9 → R² = 0.81 → 81% of variance explained
Guidelines: r < 0.1 = negligible, 0.1–0.29 = small, 0.3–0.49 = moderate, ≥ 0.5 = large (Cohen, 1988).
Correlation ≠ Causation
A significant correlation does not prove that one variable causes the other. Always consider three explanations for any observed correlation:
- 1.X causes Y (the causal interpretation you want)
- 2.Y causes X (reverse causation)
- 3.A third variable Z causes both X and Y (confounding)
Classic example: Ice cream sales and drowning rates are strongly positively correlated. Neither causes the other — both are caused by hot weather (confounders). Always draw a directed acyclic graph (DAG) to think through causal structure.
Correlation Matrices
When you have multiple variables, a correlation matrix shows all pairwise correlations simultaneously. This is useful for exploring data and identifying multicollinearity before regression.
- ●Diagonal is always r = 1 (variable with itself)
- ●Matrix is symmetric (r of X,Y = r of Y,X)
- ●Asterisks (*) typically indicate p < 0.05, (**) p < 0.01, (***) p < 0.001
- ●High intercorrelations among predictors (r > 0.7) can cause problems in regression (multicollinearity)
Practice with your own dataset
Upload a dataset with multiple continuous variables and run the Correlation analysis to see a full correlation matrix.
Required variables
- • Two or more continuous variables
- 1.Upload a dataset with 3–10 numeric variables
- 2.Select "Correlation" from the analysis menu
- 3.Choose the variables to include in the matrix
- 4.Review r values, p-values, and identify the strongest relationships
Trusted sources behind this lesson
Further reading
Read next
Nonparametric Tests
When parametric assumptions are violated, nonparametric tests provide a distribution-free alternative. Learn Mann-Whitney U, Wilcoxon, and Kruskal-Wallis.