Title: Assessing Correlation: The Pearson product moment correlation coefficient ‘r’
Course: UGQuants (SSPS) > Section: Correlation and Regression

Calculating ‘r’

As helpful as scatterplots are, it is useful to have a summary measure that allows us to describe the extent to which the various cases in our dataset align themselves in a straight line – the strength of the relationship – as well as the direction of that relationship.  When we have two interval or ratio level variables such as measure is called the Pearson product moment correlation coefficient, represented by the letter ‘r’.  This is often called Pearson’s ‘r’, for short.

We calculate this measure in such a way that for any pair of variables it always takes the value between -1 and +1, where +1 represents a perfect positive relationship, -1 represents a perfect negative relationship and 0 the absence of any relationship at all.  Not surprisingly, any figures above and below 0 represents increasingly strong relationships as they move away from 0.

Calculating ‘r’

The Pearson product moment correlation coefficient has four key assumptions.  Any violation of any of these assumptions will mean that it is not an appropriate measure to summarise the relationship between two variables.  The assumptions are:

1 | Both variables of interest are Interval or ratio level data
2 | The two variables are normally distributed.  This may mean that small samples, say, for example, less than 30, are not particularly useful
3 | The data are selected from population data or by random samples
4 | A linear (i.e. straight line) – rather than a curvilinear – relationship between the two variables

When we calculate the standard deviation of an interval or ratio level variable the first step is to calculate the variance.  The initial task for this is to calculate the squared residuals for each case in our dataset.  In other words we want to calculate how far each case is from the mean and then square that figure. Why do we square the residuals? If we didn’t square the residuals and we added them together, we would end up with 0 because the mean is the point at which the sum of residuals above the mean equal the sum of the residuals below the mean.We then add up each of the squared residuals for each of the cases in our dataset and, lastly, divide by the number of cases in our dataset.

We conduct a similar calculation when we are interested in two variables. To assess the relationship between two variables we can calculate their covariance.  For each case in our dataset we calculate how far it is from the mean of the first variable and how far it is from the mean of the second variable.  This gives us the residuals for two variables.  We then multiply these two residuals together. After doing this for each case in our dataset we then add them all together.

It is not too difficult to see why we might want to do this. If we have two variables where cases that tend to have values above the mean on one variable also tend to have values above the mean on the other variable then when we multiply together the residuals for each case the results will always be positive, so that our final sum will be high and positive.  The same is true, of course, if we have cases that tend to have values below the mean on one variable and below the mean on a second variable.

Alternatively if cases below the mean on one variable are above the mean on the other, or vice versa, our final sum will be high and negative. If values far from the mean on one variable are also far from the mean on the other variable, then the covariance will be large.

On the other hand if there is no clear relationship between the values of the two variables, we will have a mixture of small and large differences of different signs (positive and negative) that will give us a small covariance.

We can then standardise this calculation by dividing it by the standard deviations of the variables to take account of the different units that they are measured in and the different total amount of their variation.

The result of the calculation can never exceed one, nor fall below minus one, and will describe how closely related our two variables are. If the variables were perfectly related, such that their values moved 'in step', the result of our calculation would be exactly one. At the other end of the spectrum, if the variables are not related at all, so that there is no pattern in the relationship, the amount of covariance will be zero. Because we have allowed for different kinds of units of measurement and amounts of spread in different variables by using their standard deviations in the calculation, we have a value that we can use to compare the strength of the relationship between any pair of variables.

The formula for the Pearson product moment correlation coefficient is as follows:

As we can see, the numerator at the top of the equation deals with the pooled variance for the two variables of interest. The denominator, by contrast, looks a lot like the formula for the standard deviation for each of the two variables.

To calculate Pearson’s r in SPSS we can select ‘Analyze’ and then ‘Correlate’ and ‘Bivariate’. When the next series of options opens we can select our two variables of interest, and move them into the ‘variables’ box and click ‘OK’. This will then give us output that we can read fairly easily. We are interested in the top right and bottom left cells, which should appear exactly the same. This tells us that the correlation between hospital beds and life expectancy is the same as the correlation between life expectancy and hospital beds!  The first figure is the Pearson’s r. Using our original example of beds and life expectancy we can see that the figure is .476.

This suggests there is a positive correlation between the number of hospital beds and life expectancy.