Pearson correlation
This page offers all the basic information you need about the Pearson correlation coefficient and its significance test and confidence interval. It is part of Statkat’s wiki module, containing similarly structured info pages for many different statistical methods. The info pages give information about null and alternative hypotheses, assumptions, test statistics and confidence intervals, how to find p values, SPSS how-to’s and more.
To compare the Pearson correlation coefficient with other statistical methods, go to Statkat's or practice with the Pearson correlation coefficient at Statkat's
Contents
- 1. When to use
- 2. Null hypothesis
- 3. Alternative hypothesis
- 4. Assumptions of test for correlation
- 5. Test statistic
- 6. Sampling distribution
- 7. Significant?
- 8. Approximate $C$% confidence interval for $\rho$
- 9. Properties of the Pearson correlation coefficient
- 10. Equivalent to
- 11. Example context
- 12. SPSS
- 13. Jamovi
When to use?
Deciding which statistical method to use to analyze your data can be a challenging task. Whether a statistical method is appropriate for your data is partly determined by the measurement level of your variables.
The Pearson correlation coefficient requires the following variable types:
Variable 1: One quantitative of interval or ratio level | Variable 2: One quantitative of interval or ratio level |
Note that theoretically, it is always possible to 'downgrade' the measurement level of a variable. For instance, a test that can be performed on a variable of ordinal measurement level can also be performed on a variable of interval measurement level, in which case the interval variable is downgraded to an ordinal variable. However, downgrading the measurement level of variables is generally a bad idea since it means you are throwing away important information in your data (an exception is the downgrade from ratio to interval level, which is generally irrelevant in data analysis).
If you are not sure which method you should use, you might like the assistance of our method selection tool or our method selection table.
Null hypothesis
The test for the Pearson correlation coefficient tests the following null hypothesis (H0):
H0: $\rho = \rho_0$Here $\rho$ is the Pearson correlation in the population, and $\rho_0$ is the Pearson correlation in the population according to the null hypothesis (usually 0). The Pearson correlation is a measure for the strength and direction of the linear relationship between two variables of at least interval measurement level.
Alternative hypothesis
The test for the Pearson correlation coefficient tests the above null hypothesis against the following alternative hypothesis (H1 or Ha):
H1 two sided: $\rho \neq \rho_0$H1 right sided: $\rho > \rho_0$
H1 left sided: $\rho < \rho_0$
Assumptions of test for correlation
Statistical tests always make assumptions about the sampling procedure that was used to obtain the sample data. So called parametric tests also make assumptions about how data are distributed in the population. Non-parametric tests are more 'robust' and make no or less strict assumptions about population distributions, but are generally less powerful. Violation of assumptions may render the outcome of statistical tests useless, although violation of some assumptions (e.g. independence assumptions) are generally more problematic than violation of other assumptions (e.g. normality assumptions in combination with large samples).
The test for the Pearson correlation coefficient makes the following assumptions:
- In the population, the two variables are jointly normally distributed (this covers the normality, homoscedasticity, and linearity assumptions)
- Sample of pairs is a simple random sample from the population of pairs. That is, pairs are independent of one another
Test statistic
The test for the Pearson correlation coefficient is based on the following test statistic:
Test statistic for testing H0: $\rho = 0$:- $t = \dfrac{r \times \sqrt{N - 2}}{\sqrt{1 - r^2}} $
where $r$ is the sample correlation $r = \frac{1}{N - 1} \sum_{j}\Big(\frac{x_{j} - \bar{x}}{s_x} \Big) \Big(\frac{y_{j} - \bar{y}}{s_y} \Big)$ and $N$ is the sample size
- $z = \dfrac{r_{Fisher} - \rho_{0_{Fisher}}}{\sqrt{\dfrac{1}{N - 3}}}$
- $r_{Fisher} = \dfrac{1}{2} \times \log\Bigg(\dfrac{1 + r}{1 - r} \Bigg )$, where $r$ is the sample correlation
- $\rho_{0_{Fisher}} = \dfrac{1}{2} \times \log\Bigg( \dfrac{1 + \rho_0}{1 - \rho_0} \Bigg )$, where $\rho_0$ is the population correlation according to H0
Sampling distribution
Sampling distribution of $t$ and of $z$ if H0 were true:Sampling distribution of $t$:
- $t$ distribution with $N - 2$ degrees of freedom
- Approximately the standard normal distribution
Significant?
This is how you find out if your test result is significant:
$t$ Test two sided:- Check if $t$ observed in sample is at least as extreme as critical value $t^*$ or
- Find two sided $p$ value corresponding to observed $t$ and check if it is equal to or smaller than $\alpha$
- Check if $t$ observed in sample is equal to or larger than critical value $t^*$ or
- Find right sided $p$ value corresponding to observed $t$ and check if it is equal to or smaller than $\alpha$
- Check if $t$ observed in sample is equal to or smaller than critical value $t^*$ or
- Find left sided $p$ value corresponding to observed $t$ and check if it is equal to or smaller than $\alpha$
- Check if $z$ observed in sample is at least as extreme as critical value $z^*$ or
- Find two sided $p$ value corresponding to observed $z$ and check if it is equal to or smaller than $\alpha$
- Check if $z$ observed in sample is equal to or larger than critical value $z^*$ or
- Find right sided $p$ value corresponding to observed $z$ and check if it is equal to or smaller than $\alpha$
- Check if $z$ observed in sample is equal to or smaller than critical value $z^*$ or
- Find left sided $p$ value corresponding to observed $z$ and check if it is equal to or smaller than $\alpha$
Approximate $C$% confidence interval for $\rho$
First compute the approximate $C$% confidence interval for $\rho_{Fisher}$:- $lower_{Fisher} = r_{Fisher} - z^* \times \sqrt{\dfrac{1}{N - 3}}$
- $upper_{Fisher} = r_{Fisher} + z^* \times \sqrt{\dfrac{1}{N - 3}}$
Then transform back to get the approximate $C$% confidence interval for $\rho$:
- lower bound = $\dfrac{e^{2 \times lower_{Fisher}} - 1}{e^{2 \times lower_{Fisher}} + 1}$
- upper bound = $\dfrac{e^{2 \times upper_{Fisher}} - 1}{e^{2 \times upper_{Fisher}} + 1}$
Properties of the Pearson correlation coefficient
- The Pearson correlation coefficient is a measure for the linear relationship between two quantitative variables.
- The Pearson correlation coefficient squared reflects the proportion of variance explained in one variable by the other variable.
- The Pearson correlation coefficient can take on values between -1 (perfect negative relationship) and 1 (perfect positive relationship). A value of 0 means no linear relationship.
- The absolute size of the Pearson correlation coefficient is not affected by any linear transformation of the variables. However, the sign of the Pearson correlation will flip when the scores on one of the two variables are multiplied by a negative number (reversing the direction of measurement of that variable).
For example: - the correlation between $x$ and $y$ is equivalent to the correlation between $3x + 5$ and $2y - 6$.
- the absolute value of the correlation between $x$ and $y$ is equivalent to the absolute value of the correlation between $-3x + 5$ and $2y - 6$. However, the signs of the two correlation coefficients will be in opposite directions, due to the multiplication of $x$ by $-3$.
- The Pearson correlation coefficient does not say anything about causality.
- The Pearson correlation coefficient is sensitive to outliers.
Equivalent to
The test for the Pearson correlation coefficient is equivalent to:
OLS regression with one independent variable:- $b_1 = r \times \frac{s_y}{s_x}$
- Results significance test ($t$ and $p$ value) testing $H_0$: $\beta_1 = 0$ are equivalent to results significance test testing $H_0$: $\rho = 0$
Example context
The test for the Pearson correlation coefficient could for instance be used to answer the question:
Is there a linear relationship between physical health and mental health?SPSS
How to compute thePearson correlation coefficient in SPSS:
Analyze > Correlate > Bivariate...- Put your two variables in the box below Variables
Jamovi
How to compute thePearson correlation coefficient in jamovi:
Regression > Correlation Matrix- Put your two variables in the white box at the right
- Under Correlation Coefficients, select Pearson (selected by default)
- Under Hypothesis, select your alternative hypothesis