Skip to content
SPSS Tutorials

Testing Correlation in SPSS: Pearson and Spearman Explained

Run Pearson and Spearman correlation in SPSS with practice data. Choose a coefficient, inspect plots, read output and report findings with their limits.

Pearson and Spearman correlation in SPSS, illustrated by linear and curved upward scatterplot patterns.

Correlation analysis examines whether two variables tend to change together and describes the strength and direction of their association. Researchers use Pearson’s correlation to assess linear relationships between numerical variables and Spearman’s rank correlation for monotonic relationships or appropriate ranked data. In SPSS, the correlation coefficient shows the observed pattern, while a significance test assesses evidence against a zero-association null hypothesis; neither result establishes causation.

Those are different questions. You need the coefficient to describe the pattern and the p-value to evaluate the evidence against the null model. A small p-value does not establish that one variable causes the other.

This guide follows one practice dataset from Excel to SPSS, explains the results, and shows how to report them. All 240 students are simulated. The numbers were simulated for teaching, so the findings illustrate a statistical procedure rather than provide evidence about real students.

Plan the correlation before opening SPSS

  • State which two variables form a pair and which observations are independent units. Repeated observations from one person need additional consideration.
  • Inspect a scatterplot: Pearson describes linear association; a rank coefficient is useful for an ordered or monotonic association.
  • Choose the coefficient and direction of the hypothesis before examining which result is significant.
  • Plan how you will handle missing pairs, outliers and multiple comparisons.

The worked dataset below supports both a Pearson and a Spearman example. Keep the method, coefficient, complete-pair count and interpretation together when reporting. Kent State’s correlation guide explains the procedure and output.

Start with the relationship you want to understand

Imagine recording each student's revision time during the week before an exam and their final score. Each student contributes a pair of measurements: hours and points. You want to know whether higher revision hours tend to accompany higher scores across students.

Student 1 in the downloadable workbook has 4.5 revision hours and an exam score of 65.3. Student 2 has 10.0 hours and a score of 65.4. Those two students alone show why individual comparisons are insufficient: substantially different revision times can accompany almost identical scores. Correlation summarises the pattern across all 240 pairs.

For quantitative measurements such as these, Pearson's correlation coefficient, written r, describes the strength and direction of a straight-line relationship. It ranges from −1 to +1. Positive values mean that higher values of one variable tend to accompany higher values of the other. Negative values mean that higher values tend to accompany lower values. Values close to zero indicate little linear association. IBM describes Pearson correlation and its scale here.

The sign gives direction, not quality. A negative correlation can be substantial and useful. Nor is r a percentage: r = .576 does not mean that 57.6% of students improved, or that scores rise by 57.6% when revision increases. A correlation has no measurement units.

Meet the practice dataset

Download the Excel workbook. Its Data sheet contains one student per row, one variable per column, and names in the first row. The Guide sheet explains the coding and simulation. There are no missing values.

Variable What it records Role in this tutorial
student_id Simulated case number, 1–240 Identifier; exclude from correlation tests
revision_hours Revision hours in the preceding week Pearson example
exam_score Exam score out of 100 Outcome paired with each teaching variable
stress_rating Single rating from 1, very low, to 5, very high Spearman example
leisure_hours Typical daily leisure screen hours Example with little linear association

Keeping the identifier out matters. SPSS can calculate a correlation between case numbers and scores, but student numbering has no substantive meaning here. A result becomes interpretable only when the variables represent a sensible research question. For a model that specifies a predictor and an outcome, first distinguish independent and dependent variables.

The simulation deliberately includes an upward hours–score pattern, a downward stress–score pattern, and leisure values generated independently of scores. This makes the file useful for comparing interpretations. It does not tell you which relationships would appear in a real study.

Which correlation statistical test should you use?

Choose the method from the question, measurement scale, and shape of the data before comparing p-values. Pearson and Spearman answer related but different questions.

Method What it summarises Example here
Pearson's r Linear association between quantitative measurements Revision hours and exam score
Spearman's rank correlation Association between ranks; useful for ordered measurements and a monotonic pattern Stress rating and exam score
Kendall's tau-b Rank concordance, with an adjustment for tied ranks Another option for ordered data; not run in this walkthrough

A monotonic pattern moves generally in one direction: as one variable increases, the other tends to increase, or tends to decrease. It can bend without reversing direction. Spearman correlation uses ranks, meaning positions in an ordered list, rather than the original measurement distances. NIST's rank-correlation reference explains this calculation, including average ranks for tied measurements.

Our stress item has ordered categories. We know that 5 represents more stress than 4, but have not established that the distance between 4 and 5 equals the distance between 1 and 2. Spearman is a reasonable teaching choice for that question. It accommodates tied ratings by using the ranking procedure implemented in SPSS.

Choose Pearson for a roughly linear quantitative relationship, Spearman for ordered ratings with a monotonic relationship, and investigate curves that reverse direction.
Figure 1. The starting point is the question and the plotted pattern. A U-shaped relationship can be poorly represented by either a single linear or a single monotonic coefficient.

Do not automatically select Spearman whenever a normality test returns p < .05. First inspect the measurements and the relationship you want to describe. Ranking changes the quantity being estimated. It also does not solve dependence between observations or make a U-shaped relationship monotonic.

Check the data before testing correlation

Start with a scatterplot: place revision hours on the horizontal axis and exam score on the vertical axis. Each dot represents one student. In SPSS, the usual route is Graphs → Legacy Dialogs → Scatter/Dot → Simple Scatter → Define. Assign the two axes and select OK.

Scatterplot of all 240 simulated students, showing an upward, roughly straight association between revision hours and exam score, with considerable variation.
Figure 2. Plot of the downloadable practice data, created separately from SPSS. The upward tendency is visible, but revision time does not determine an individual student's score.

Look for a roughly straight pattern, unusual observations, distinct groups, and changes in spread. An extreme observation can greatly influence Pearson's r. Investigate whether an unusual value is a recording error, a valid observation, or evidence that your proposed analysis misses something. Do not remove it simply to obtain a preferred result. Penn State illustrates how outliers can alter correlation.

The rows should also represent independent observational units for the standard significance test. Recording the same student every week creates repeated observations. Treating all those rows as independent students can make the evidence appear stronger than it is. A suitable repeated-measures or multilevel analysis may then be needed.

You can calculate Pearson's r without normally distributed variables. However, the usual exact t significance test for zero population correlation assumes independent pairs sampled from a bivariate normal population, meaning a particular joint distribution of the two variables. The plot and study design therefore matter alongside the coefficient. Two separate normality tests cannot establish all these conditions. IBM's bivariate correlation guidance describes the distributional assumption.

For this exercise, the scatterplot provides a useful roughly linear example. Because the observations were simulated with bounds and rounding, treat the p-values as practice calculations, not a claim that a real study's sampling assumptions have been validated.

Import the Excel data into SPSS

For a normal Excel import, choose File → Open → Data, select the Excel file type, and open correlation-demo.xlsx. Select the Data worksheet and read variable names from its first row. If you specify a range, use A1:E241: one header row plus 240 observations. Importing the Guide sheet would bring in documentation rather than student records.

The SPSS 27 installation used for this walkthrough returned a Java startup error when opening Excel and a server error when importing XLSX through syntax. The successful route used a CSV export of the workbook's Data sheet. Every exported value was checked against the Excel workbook before import. The screenshots below show that CSV route, rather than a successful direct XLSX import.

If you encounter the same problem, open the workbook in Excel, select Data, and save that sheet as CSV. In SPSS, open the CSV with the text import wizard. Specify a comma delimiter, variable names in the first row, and numeric formats for all five columns. The CSV analysis syntax in the supplied practice package performs this import explicitly. Alternatively, extract correlation-demo.sav from the practice package and open it in SPSS to practise the analysis immediately.

In Variable View, set revision_hours, exam_score, and leisure_hours to Scale, stress_rating to Ordinal, and student_id to Nominal. These labels describe the measurements; assigning Scale to an arbitrary code does not make it a meaningful quantitative variable.

SPSS Data View after importing the verified CSV export of the Excel Data sheet, showing the five variables and the first student records.
Screenshot 1. The Excel data reached SPSS through the verified CSV export. Student 1 has 4.5 revision hours and an exam score of 65.3, matching the workbook.

Run Pearson's correlation in SPSS

Open Analyze → Correlate → Bivariate. Move Revision hours per week and Exam score out of 100 into the Variables box. Select Pearson and Two-tailed. Under Options, you can request means and standard deviations and choose how to exclude missing cases. Select OK to run the test.

A two-tailed test allows evidence in either direction, positive or negative. A one-tailed test needs a defensible directional hypothesis chosen before examining the results. Switching tails after seeing your coefficient changes the testing procedure.

SPSS Bivariate Correlations dialog configured for revision hours and exam score with Pearson and a two-tailed significance test.
Screenshot 2. Select the two substantive variables and the method that matches the research question.

The supplied syntax uses listwise exclusion. For each command, that means retaining only cases with complete values on the variables named in that command. Pairwise exclusion instead uses the available complete pairs for each coefficient, so a larger matrix can contain different sample sizes. These practice data are complete, so both choices retain all 240 cases. IBM explains these options in its missing-value guidance.

Read the correlation coefficient and significance test

SPSS reports r = .576 for revision hours and exam score, with Sig. (2-tailed) < .001 in the Viewer. Its text export displays the same small p-value as .000 after rounding. All 240 cases were included. The association is positive: students with more revision hours generally have higher scores in this simulated file.

SPSS Pearson output for revision hours and exam scores, showing r = .576, p < .001, cross-product totals, and listwise N = 240.
Screenshot 3. Genuine SPSS output showing p < .001. A .000 value in a rounded text export should also be reported as p < .001, rather than p = .000.

For this two-tailed Pearson test, the null hypothesis is that the population correlation, written ρ, equals zero. The alternative is that it differs from zero. Under the null model and test assumptions, the p-value is the probability of obtaining a correlation at least as extreme in either direction as the one observed.

Here that probability is very small. With a threshold of .05 specified beforehand, you would reject the zero-correlation null hypothesis. This does not mean the null hypothesis has a .000 probability of being true, or that the relationship is practically important. The American Statistical Association's statement explains why a p-value cannot supply either conclusion.

The coefficient and its context still matter. Describe r = .576 directly and compare it with relevant research and practical expectations. Universal labels such as “weak,” “moderate,” and “strong” can obscure differences between disciplines. A statistically detectable association can also be too small to be useful.

How to find the correlation: a worked r-value equation

Pearson's r is calculated by comparing how the two measurements depart from their respective averages. The mean revision time in the actual practice file is 11.12917 hours, and the mean exam score is 68.17625 points.

For Student 1, the deviations are approximately 4.5 − 11.12917 = −6.62917 hours and 65.3 − 68.17625 = −2.87625 points. Both are below their averages. Multiplying these deviations gives a positive contribution to the overall association. A student who is above average on one measurement and below average on the other contributes a negative product.

The complete r-value equation is:

r = Σ(xi − x̄)(yi − ȳ) / √[Σ(xi − x̄)² × Σ(yi − ȳ)²]

The bar means average, the subscript i identifies a student, and the summation sign means add across students. The denominator rescales the combined deviations so the result lies between −1 and +1.

Using all 240 rows, the cross-product sum is 5904.55625. The squared-deviation sums are 3961.89583 for revision hours and 26523.31463 for exam scores. Substitution gives:

r = 5904.55625 / √(3961.89583 × 26523.31463) ≈ 0.575999 ≈ .576

These are the same totals shown, rounded, under Sum of Squares and Cross-products in the SPSS output. The calculation explains how the file produces the coefficient, rather than introducing a different miniature dataset. Penn State's regression lesson covers the correlation calculation and interpretation.

What is the correlation test statistic?

For the conventional test of H₀: ρ = 0, Pearson's r can be converted into a t statistic:

t = r × √[(n − 2) / (1 − r²)]df = n − 2

Here n is the number of complete pairs, and df means degrees of freedom, the parameter selecting the reference t distribution. With the unrounded r = 0.575999 and n = 240, t is approximately 10.870, with 238 degrees of freedom. Comparing its magnitude with that reference distribution gives the two-tailed p-value. Penn State sets out this test of the population correlation.

This is the calculation people mean by a “t test for a correlation coefficient.” Its purpose is to test a zero population correlation. An independent-samples t test, which compares the means of two groups, answers a different research question. The SPSS Bivariate Correlations table reports the coefficient and significance directly, so you do not need to run a separate group-comparison test.

Run Spearman's correlation for the stress rating

Return to Analyze → Correlate → Bivariate. Replace the previous pair with Stress rating (1 low to 5 high) and Exam score out of 100. Clear Pearson, select Spearman, keep the two-tailed test, and run it. Choosing only the intended coefficient keeps the output easier to read.

SPSS reports Spearman's rho = −.618, with p < .001, using all 240 cases. Students with higher stress ratings generally have lower scores in the practice data. The minus sign describes that downward association. It does not make the relationship weaker than a positive coefficient with the same magnitude.

SPSS Spearman output for stress rating and exam score, showing rho = −.618, p < .001, and listwise N = 240.
Screenshot 4. Spearman summarises the association between the ranked measurements. SPSS labels the statistic “Spearman's rho.”

A rank coefficient is useful here because the stress response is ordered, and the intended comparison concerns whether higher ratings accompany lower scores. It does not estimate how many exam points correspond to a one-category change in stress. For that kind of quantitative prediction, you would need a model appropriate to the measurement and research question.

Compare a result with little linear association

The final example pairs leisure_hours with exam_score using Pearson's test. SPSS gives r = .027, p = .677, and N = 240. The coefficient is close to zero, and the test does not provide evidence against the zero-correlation null at a .05 threshold.

Pair of variables Test Coefficient Two-tailed p Complete pairs
Revision hours and exam score Pearson .576 < .001 240
Stress rating and exam score Spearman −.618 < .001 240
Leisure screen hours and exam score Pearson .027 .677 240

That last result is not proof that leisure and scores are unrelated in every possible way, or in a real student population. It describes weak linear association in this practice sample and insufficient evidence against the particular null model. A curve, measurement error, or limited precision can complicate a real nonsignificant result.

These three comparisons were selected to teach different interpretations. In an actual project, state which comparisons were planned and which were exploratory. Running many correlations and highlighting only small p-values gives an incomplete account of the analysis. The ASA's guidance on transparent inference is relevant here.

How to report the correlation coefficient

A useful report names the variables and method, gives the coefficient and sample size, and states the p-value. Include a confidence interval when available and explain the substantive direction of the relationship. Avoid replacing the result with “there was a significant correlation.” That sentence omits its size and direction.

For the main example, you could write: “In the simulated practice dataset, revision hours were positively associated with exam scores, Pearson's r(238) = .576, p < .001, N = 240.” The number in parentheses is the Pearson test's degrees of freedom, rather than the sample size.

For the ordinal example: “Higher stress ratings were associated with lower exam scores, Spearman's rₛ = −.618, p < .001, N = 240.” Retain the simulation label if you use either sentence in a tutorial, assignment, or demonstration.

An independently calculated approximate 95% Fisher-z confidence interval for the main Pearson coefficient is [.485, .655]. This interval is supplied as a separate calculation; it is not displayed in the SPSS screenshots. Fisher's transformation is a standard approximate approach to correlation intervals, as described in NIST's confidence-interval reference.

A confidence interval helps communicate precision. Under the sampling model, the interval-producing procedure would cover the true correlation in about 95% of repeated samples. It is not a statement that 95% of students follow the relationship. For these simulated data, it mainly provides practice in reporting uncertainty.

What correlation cannot tell you

A correlation does not identify the cause of an association. In a real observational study, prior knowledge, motivation, teaching support, or another factor could affect both revision time and exam performance. A correlation test alone cannot separate these explanations. Penn State discusses the distinction between association and causation.

Also distinguish correlation from prediction. The coefficient does not give a slope in exam points per hour, and it cannot guarantee a particular student's score. If your question concerns predicting scores while accounting for prior achievement, you may need regression and a defensible model. That is a new analytical decision, rather than something the correlation matrix has already answered.

Before applying this workflow to your own data, write one sentence naming the pair, the kind of relationship you want to summarise, and the observations that count as independent units. Then inspect the plot. Those decisions make the eventual coefficient and p-value much easier to interpret.

Frequently asked questions

Does a correlation near zero mean there is no relationship?

It means little association of the kind the coefficient summarises. A strong curved pattern can have a small Pearson correlation. Inspect the plot before concluding that the variables are unrelated.

Does a significant Spearman correlation show causation?

No. Ranking the measurements changes the association being summarised; it does not remove confounding or establish time order. The study design determines which causal interpretations could be defensible.

Why can the sample size differ across a correlation matrix?

With pairwise missing-data handling, each coefficient uses cases with valid values for that pair. Different pairs can therefore have different sample sizes. Check the N entries and record the missing-data setting rather than reporting one assumed sample size for every coefficient.

For comparisons of group means, use the t-test guide or ANOVA guide. For overlap among several regression predictors, see VIF and tolerance.

Found this guide useful? Share on LinkedIn

Discussion

Leave a Reply

Your email address will not be published. Required fields are marked *