Correlation Analysis
A method for checking whether two variables tend to rise or fall together, and how strong that relationship is.
Do students who study longer also score higher on tests? Does more sleep mean less fatigue? How can we check how two quantities are related to each other?
The method for finding out the direction and degree to which two numeric variables change together is called correlation analysis.
Whereas the mean and standard deviation describe each variable separately, correlation analysis looks at two variables in pairs and uses a correlation coefficient to show how clear their tendency to rise or fall together is. But the presence of a relationship does not mean that one variable causes the other.
It is useful for a first look at relationships between variables in education, psychology, health, consumer behavior research, and more. In this lesson we use the relationship between study time and test scores as an example to cover what a correlation coefficient means, how to read scatter plots and p-values, the difference between Pearson and Spearman correlation, reporting the results, and things to watch out for.
What is correlation analysis?
An analysis that looks at the direction and degree to which two numeric variables change together.
Correlation analysis is a method for checking whether two variables tend to rise or fall together, and how clear that relationship is. The most widely used measure, the Pearson correlation coefficient, expresses the linear relationship between two variables as a value from −1 to +1.
For example, you can look at whether students who study longer get higher test scores, or whether resting heart rate goes down as exercise time goes up. But a correlation does not let you conclude that one variable causes the other.
Why do we need correlation analysis?
Looking at means and distributions separately makes it hard to tell whether variables move together.
Calculating the mean study time and the mean test score separately tells you the level of each variable, but not whether people who study more actually score higher. Correlation analysis takes the two values measured on the same person as a pair and examines their relationship.
By looking at the overall pattern in a scatter plot and calculating a correlation coefficient, you can describe both the direction and the strength of the relationship. It is also used to explore which of many variables move in similar ways.
How does correlation analysis work?
It pairs the two values of each observation and checks whether they deviate from their means in the same direction.
① Observe the two variables in pairs
Each person in the analysis must have values for both variables, such as study time and test score. If you pair values from different people arbitrarily, you cannot get a correct correlation.
② Look for patterns in a scatter plot
If the points cluster toward the upper right, the relationship is positive; if toward the lower right, it is negative. If there is no clear straight-line pattern, the Pearson correlation coefficient may be close to 0.
③ Divide the covariance by the standard deviations of the two variables
r = Cov(X, Y) / (sX × sY)
Standardizing the covariance expresses it on a scale from −1 to +1, regardless of the variables’ units.
④ Read the direction and size together
The sign shows the direction of the relationship, and the absolute value shows how clear the linear relationship is. A large absolute value does not automatically determine how important the effect is. You need to consider the research context and the measurement methods as well.
A real-world example: analyzing study time and test scores
We surveyed the weekly study time and test scores of 12 hypothetical students.
Suppose an education researcher wants to look at the relationship between how long students studied in a week and their test scores. The numbers below are example data made up for illustration, not results from a real survey.
| Student | Study time (hours/week) | Test score (points) |
|---|---|---|
| 1 | 2 | 58 |
| 2 | 3 | 62 |
| 3 | 3 | 55 |
| 4 | 4 | 67 |
| 5 | 4 | 64 |
| 6 | 5 | 69 |
| 7 | 5 | 73 |
| 8 | 6 | 71 |
| 9 | 6 | 78 |
| 10 | 7 | 76 |
| 11 | 8 | 84 |
| 12 | 9 | 86 |
The scatter plot shows that test scores generally rise as study time increases. Some students got different scores despite studying for the same amount of time, so not all the points lie on a single straight line.
How do you interpret the correlation coefficient (r)?
The first thing to check in the results is the direction of the relationship and its linear strength.
The Pearson correlation coefficient is r = 0.957. Because it is positive, test scores tend to be higher for students with longer weekly study time. And because the value is close to +1, this example shows a very clear positive linear relationship.
A correlation coefficient of 0 means no linear relationship is observed, not that there is no relationship of any kind between the two variables. That is because there may be a nonlinear pattern, such as a U shape.
What are the p-value and confidence interval of a correlation coefficient?
They show the uncertainty when you interpret a relationship calculated from a sample at the population level.
| Measure | Example result | Meaning |
|---|---|---|
| Sample size | 12 | Number of observations used in the analysis |
| Pearson r | 0.957 | Positive linear relationship |
| p-value | < 0.001 | Two-sided test of a population correlation of 0 |
| 95% confidence interval | [0.849, 0.988] | Fisher z-transformation approximation |
The null hypothesis is that the Pearson correlation coefficient in the population is 0. In this example, the two-sided p-value is less than 0.001, so there is statistical evidence against the hypothesis that the population correlation is 0.
The 95% confidence interval shows the uncertainty in the estimated correlation. But since this is a small convenience example of 12 students, be careful about generalizing the results to a population.
Which measures do you check in correlation results?
Don’t look at the coefficient alone; read the shape of the data and the uncertainty of the estimate along with it.
| Measure | What to check |
|---|---|
| Number of observations (n) | Number of pairs actually analyzed, excluding missing values |
| Pearson correlation coefficient (r) | Direction and strength of the linear relationship |
| Spearman correlation coefficient (ρ) | Monotonic relationship based on ranks |
| p-value | Compatibility with the hypothesis of a population correlation of 0 |
| Confidence interval | Uncertainty of the estimated correlation |
| Scatter plot | Linearity, curved patterns, clusters, outliers |
| Handling missing values | Whether only complete pairs were used, etc. |
Don’t confuse it with the coefficient of determination (r²)
In this example, r² is about 0.916. In a simple linear regression with an intercept, this equals the proportion of the variation in the dependent variable within the sample that is explained by the linear model. It should not be interpreted causally, as in “study time produced 91.6% of the scores.”
How do correlation analysis and regression analysis differ?
Both deal with relationships between variables, but they answer different questions.
| Aspect | Correlation Analysis | Regression analysis |
|---|---|---|
| Main purpose | Identify the direction and strength of a relationship | Estimate the relationship between explanatory and outcome variables, and predict |
| Roles of the variables | X and Y are treated symmetrically | Explanatory variable (X) and outcome variable (Y) are distinguished |
| Typical measures | r, ρ, p-value | Regression coefficients, confidence intervals, R², etc. |
| Units | The correlation coefficient has no units | Regression coefficients depend on the variables’ units |
| Main question | Do the two move together? | How much does Y change when X changes? |
If you are at the stage of checking whether study time and scores are related, correlation analysis is appropriate. If you want to estimate the average difference in scores for each extra hour of study, or to control for other conditions, consider regression analysis.
How do Pearson and Spearman correlation differ?
Choose the appropriate method based on the type of data and the shape of the relationship.
| Aspect | Pearson | Spearman |
|---|---|---|
| Main use | Linear relationships between numeric variables | Ranks or monotonic relationships |
| How it is calculated | Standardizes the covariance of the original values | Converts each value to a rank and calculates the correlation |
| Shape of relationship | Straight-line trend | A trend that rises or falls in one direction |
| Effect of outliers | Can be strongly affected | Can be relatively less sensitive |
| Coefficient | r | ρ (rho) |
For the same study time and test score data, Pearson’s r is 0.957 and Spearman’s ρ is 0.958. In this example both methods show a strong positive relationship. But they do not always give similar values.
Spearman correlation doesn’t solve every problem either. In particular, data with many tied ranks or complex nonlinear relationships need separate checks.
Things to watch out for in correlation analysis
More important than the calculation is not misinterpreting the coefficient.
Check the scatter plot for nonlinear relationships.
Even when Pearson’s r is small, a curved relationship may exist. It is safer to look at the scatter plot before looking at the correlation coefficient.
Results can change because of outliers.
A single observation can change the coefficient a great deal. Don’t delete outliers automatically; first check whether they are data errors or genuinely important cases.
A narrow sample range can weaken the correlation.
If you survey only students in a similar score range, the relationship may look weaker than it would among all students. Consider which group the sample represents.
If the groups are not the same, the interpretation can change.
If characteristics differ by grade or school, the overall correlation can differ from the relationship within groups. Look at the distribution of the mixed groups and at potential confounders together.
Correlation is not causation.
Even if study time and test scores rise together, that alone does not prove that more study time caused the higher scores. Other factors, such as prior ability, the learning environment or motivation, may have played a role.
What extensions of correlation analysis are there?
Depending on the research situation, you can go beyond the simple relationship between two variables.
Partial correlation
Examines the relationship between two variables after statistically removing the linear influence of a third variable. For example, you can explore the relationship between study time and test scores while accounting for differences in prior achievement.
Kendall’s rank correlation (Kendall’s τ)
Assesses a monotonic relationship based on how often pairs of observations are concordant or discordant in rank. It can be considered when the sample is small or when dealing with ranked data.
Correlation matrix
When there are many variables to analyze, the correlation coefficients for every pair of variables are arranged in a matrix. This helps you find strongly associated combinations of variables or check for possible multicollinearity before a regression analysis.
Repeated-measures and clustered data
When the same students are measured several times, the usual correlation analysis, which assumes independent observations, may not be appropriate. Consider methods that fit the data structure, such as repeated-measures correlation or multilevel models.
How do you report correlation results?
In a paper or report, state clearly which variables were analyzed and the main statistics.
Describing the results based on the example data gives the following.
A Pearson correlation analysis was performed to examine the relationship between weekly study time and test scores for 12 students. The results showed a strong positive correlation between the two variables (r = 0.957, p < .001, 95% CI [0.849, 0.988]). In other words, students who studied more tended to have higher test scores.
In real research, also present how the sample was selected, the units of measurement of the variables, how missing values were handled, what the scatter plot showed, and so on. Be careful not to describe correlation results as causal effects.
Where can correlation analysis be used?
It is a basic tool for exploring relationships between numeric variables in many fields.
Education research
Look at relationships between study time and achievement, or between attendance and assignment scores.
Psychology and behavioral research
Examine relationships between stress scores and sleep quality, or between satisfaction and intention to keep using a service.
Health and medical research
Explore associations between exercise time and blood pressure, or between age and health-related scores.
Business and marketing
Check relationships between customer satisfaction and repurchase intention, or between ad exposure and brand awareness.
Economics and social science
See whether income and spending, or regional education levels and various social indicators, change together.
In every field, understanding what a correlation coefficient means requires considering the sample, how the data were collected, and potential confounders.
Correlation analysis puts a number on how two variables move together.
Summarize the direction and strength with a correlation coefficient, and look at the scatter plot and confidence interval too, so you can interpret the results more accurately.
Correlation analysis uses a correlation coefficient to summarize the direction in which two numeric variables rise or fall together and how clear that relationship is. As in the study time and test score example, it analyzes the two variables in pairs from the same subjects, and it is good to check the size and direction of the relationship on a scatter plot as well.
A correlation coefficient alone cannot tell you the shape of a relationship or whether it is causal. Check for nonlinear relationships and outliers, the sample size and the confidence interval, and choose Pearson, Spearman or another analysis based on your research question.
The point of correlation analysis is to describe the relationship between two variables, not to prove causation. The Pearson correlation coefficient summarizes a linear relationship, and the Spearman correlation coefficient a monotonic relationship based on ranks. Check not just the sign and size of the coefficient, but also the scatter plot, the sample size, outliers and the confidence interval.