Correlation

Spearman Rank Correlation

Relates two variables through their rank positions rather than their raw values, and reports the direction and strength of the monotonic association between them.

Method summary

Spearman's rank correlation orders each variable separately from low to high and computes the coefficient from those rank numbers. Technically it is a product-moment correlation applied to ranks, and what it measures is whether one variable rises steadily as the other does, that is, whether the association is monotonic. Monotonicity is a looser condition than linearity: the relationship may follow a curve, so long as it does not change direction. Working with ranks has two practical consequences. First, the distances between scale steps drop out of the computation, which makes ordinal measures defensible material. Second, a value far out at the end of a scale can carry no more weight than its rank position, which leaves the coefficient more resistant to extreme observations. YouReply Analyze returns rho, the two-tailed p value, the number of observations used and a strength label derived from the absolute magnitude.

Which research questions does it answer?

  • Does saving frequency rise steadily as the income bracket goes up?
  • Is there a monotonic association between education level and how often digital banking is used?
  • Do participants' brand awareness rankings line up with their purchase priority rankings?
  • Does a service quality rating move in the opposite direction to the tendency to file a complaint?

When should you use it?

  • When one or both variables are ordinal: graded categories, income brackets, frequency steps, single Likert items.
  • When continuous variables are clearly skewed, or show ceiling and floor effects.
  • When the scatter plot shows a relationship that keeps one direction yet does not look straight, rising quickly at first and then slowly, for instance.
  • When a few distant observations are dragging the linear coefficient around and there is no justification for removing them.
  • When the variables were collected as rankings in the first place, as in questions where respondents order options from first to last.

Required variable types

  • Both variables must be orderable: an ordinal scale, a ranking, or a continuous measure. Setting the measurement level to 'ordinal' on the Variable tab makes the method picker suggest the right methods.
  • An ordinal variable has to be coded numerically in a way that preserves its ordering; labels coded alphabetically produce the wrong order.
  • Relating a continuous variable to an ordinal one poses no problem here, since the continuous one is converted to ranks as well.
  • With very few categories, a three-step scale for example, the share of tied values rises and the coefficient struggles to approach its extremes.
  • Rows with missing values are dropped pairwise, and the reported number of observations reflects the pairs left after that.

Key assumptions

A monotonic relationship
The coefficient captures one variable rising or falling consistently as the other rises. If the relationship reverses past a point, tracing a curve that peaks in the middle for instance, the opposing stretches cancel and rho stays small.
Orderable measurement
The values of both variables need to line up meaningfully. Equal spacing between steps is not required, and that flexibility is exactly what lets this method work with ordinal data.
Independent pairs
Every row should be a separate pair of observations. Where one participant occupies several rows, or observations arrive in clusters, the p value is more optimistic than it should be.
The share of tied values
Observations sharing a value receive the average rank. As the proportion of ties grows, particularly on scales with few steps, the largest value the coefficient can reach falls below 1 and rho shrinks systematically.

How YouReply checks these assumptions

  • A monotonic relationship: No test of monotonicity is performed. The chart drawn when scatter data are present in the result is the easiest way to see whether the direction reverses.
  • Orderable measurement: The method picker looks for orderable numeric columns and dims the method with its reason where a column does not qualify; the data requirements box lists the columns that do.
  • Independent pairs: The panel does not check this assumption automatically; the researcher evaluates it.
  • The share of tied values: Ranking follows scipy's default behaviour, so tied values take average ranks, and the panel does not report the count or proportion of ties as a field of its own. Gauging that share from the number of steps on your scale is left to you.

How the analysis is run

  1. 1Drag your file into the panel; once the upload finishes the rows appear in the editable grid, where faulty cells can be corrected.
  2. 2On the Variable tab check how the ordinal variables are coded: the steps need ascending numeric values and the value labels should carry the names of those steps.
  3. 3Declare your missing-value codes on the same tab. Codes such as 9 or 99, common on ordinal scales, otherwise rank as the highest step and distort the coefficient.
  4. 4On the Analysis tab open the correlation group and select this method; typing the name of the coefficient into the search box gets you to the same place.
  5. 5Pick the two columns in the parameter form and start the run. Each column is ranked separately, so their order makes no difference to the result.
  6. 6Read the coefficient, the p value and the number of observations from the collapsible sections, and where scatter data exist study the chart for any change of direction.
  7. 7Save the output as Excel and the chart as PNG; the history tab holds earlier runs and the computation credits card names the call and version used.

Statistics and tables produced

Rank correlation coefficient
rho, ranging from -1 to +1. It reaches +1 when the two orderings coincide exactly and -1 when one is the exact reverse of the other.
Significance value
The two-tailed p value computed on the hypothesis of no monotonic association in the population. In small samples it is an approximation and can move noticeably when a single observation changes places.
Number of observations
The count of pairs holding a valid value in both columns, expected alongside the coefficient in any report.
Strength and direction label
A verbal label derived from the absolute magnitude of the coefficient, stated together with the direction. The thresholds match those used for the linear coefficient.
Relationship charts
The correlation bar chart reserved for correlation methods is drawn, joined by a scatter plot where scatter data are present. The points in that plot show raw values, while the coefficient comes from ranks.

Effect size and confidence intervals

rho itself
Being unit-free, the coefficient reads directly as an effect size. The panel's labels work from the absolute value: below 0.2 negligible, below 0.3 weak, below 0.5 moderate, below 0.7 strong and above that very strong. On ordinal scales with few steps the high proportion of ties suppresses the coefficient's ceiling, so it is reasonable to loosen those same thresholds a little for such data.
rho squared
It can be read as the share of variability the two orderings hold in common, but it is not variance explained in the raw values. The panel does not return it as a field; if you compute it, say that the interpretation stays at the level of ranks.

No confidence interval is computed: rho, the p value and the number of observations are all point estimates. Interval estimation for a rank correlation usually relies on resampling, which the panel does not perform, so an interval has to be produced elsewhere. For the same reason the result does not test the difference between coefficients obtained in two subgroups.

Example research question and example result

The numbers below are a representative example, not data from a real study or a real user.

Research question
In an illustrative financial behaviour study, is there a monotonic association between a six-step income bracket and a five-step measure of saving frequency?
Variables
First variable: household income bracket, six-step ordinal scale · Second variable: saving frequency, five-step ordinal scale from never to every month
Example result
268 participants answering both questions entered the analysis. The coefficient was rho = 0.36, p < 0.001, and the label describes a moderate positive association. Since both variables have few steps, the share of ties is high: the answers spread over 30 possible step combinations. In the scatter plot the points cluster on the steps and the cloud leans upward, with no visible peak or reversal.
Interpretation
Saving frequency steps tend to rise as the income bracket does, so the two orderings overlap, though the size of the coefficient shows the overlap is far from perfect. With a six-step and a five-step scale, many observations share a rank, which structurally keeps the coefficient away from 1, and 0.36 should be read with that ceiling in mind. The coefficient does not say how many steps of saving frequency accompany a one-step rise in income, because ranks carry no scale units. Neither can the reason for the association be taken from these data: spending obligations or financial literacy may be moving both measures at once. The figures are illustrative.

Real output on a sample dataset

The results below were produced by the analysis engine from this data file. Changing the variable changes the research question as well; every run was computed in advance, so the page sends no request to the engine.

Variable examined

General customer survey (synthetic)

A wide survey of three hundred respondents: two and three category grouping variables, continuous measures, a five point ordinal scale, a binary purchase outcome, a four category brand choice, three repeated measurements, paired binary questions, three raters, four price questions and deliberately empty cells.

Rows
300
Columns
respondent_id, gender, education, region, age, income, satisfaction, service_score, price_score, quality_score, loyalty, nps_score, purchased, brand_choice, satisfaction_level, pre_score, post_score, measure_1, measure_2, measure_3, use_before, use_after, use_followup, rater_1, rater_2, rater_3, price_too_cheap, price_cheap, price_expensive, price_too_expensive, feedback_score, followup_rating
Download the dataset as CSV

The data is synthetic: it comes from a fixed random seed, not from a real study. The values below were produced by the analysis engine from this file, so uploading the same file to the panel gives the same results.

Research question: As satisfaction rises, does the recommendation score rise at the rank level too?

First variable
satisfaction
Second variable
nps_score
Correlation coefficient
0.695
p value
< 0.001
Valid observations
300

Computation credits: scipy 1.18.0 · statsmodels 0.14.6 · scikit-learn 1.9.0 · numpy 2.5.1 · pandas 3.0.5 · semopy 2.3.11 · 89fc29a · Data seed: 20260914

How to report the result

Household income bracket showed a moderate positive rank association with saving frequency, rho = .36, p < .001, n = 268.

An example sentence close to APA style; the numbers are representative.

When you should not use it

  • In relationships that change direction the coefficient stays small, since in a pattern peaking in the middle the opposing stretches offset one another and rho understates the association.
  • On scales with few steps the rising share of ties pushes the coefficient's ceiling below 1, so a low rho does not always mean a weak relationship.
  • The coefficient reports no slope; questions about change per step or about prediction call for a model suited to ordinal outcomes.
  • It carries no causal direction: two orderings overlapping is not evidence that one produces the other.
  • Moving to ranks discards some of the information in the raw values, which costs a little power relative to the linear coefficient when continuous data really are linear and close to normal.
  • Because ranks are assigned within the sample at hand, the coefficient is sample-dependent, the same two variables can yield a different rho elsewhere, and the panel offers no interval for that uncertainty.

What to use when the assumptions are not met

  • Pearson CorrelationWhy: When both variables are continuous and the scatter plot looks straight; it uses the information in the raw values and is more sensitive under those conditions.
  • Kendall's Tau-bWhy: When ties are very frequent or the sample is small; counting concordant and discordant pairs gives a more conservative coefficient.
  • Kruskal-Wallis H TestWhy: When one variable really defines a handful of groups, where testing rank differences between groups answers the question more directly than a coefficient.
  • Cross-TabulationWhy: When the priority is describing the pattern, seeing the step combinations of two ordinal variables in counts and percentages.

Frequently asked questions

When should I choose this coefficient over Pearson's?
In three situations: when one of the variables is ordinal, when the distribution is clearly skewed, or when the relationship in the scatter plot keeps one direction without looking straight. If extreme values are dragging the coefficient around and you have no grounds for removing those observations, this coefficient gives a sturdier summary, because a distant value weighs only one rank position.
My scale has many identical answers. Are ties a problem?
They do not block the computation: observations sharing a value receive the average rank and the coefficient is built from those ranks. The count or proportion of ties is not reported as a separate field, so judging that share from the number of steps on your scale is your task. As ties multiply, the largest attainable value of the coefficient falls; between two five-step scales an rho above 0.70 is hard to reach in practice. Where ties dominate, Kendall's tau is the better option.
Does rho capture curved relationships?
It captures curves that keep one direction. A relationship that rises with acceleration or deceleration can still produce a high coefficient because the orderings agree, and reaches 1 when the association is perfectly monotonic. What it misses is a reversal: in a pattern that peaks in the middle or traces a U, the rising and falling stretches cancel out. That is why a low coefficient should not be read as the absence of a relationship before looking at the scatter plot.
rho and the linear coefficient differ noticeably on the same data. What does that tell me?
The gap between them is informative. An rho clearly above the linear coefficient suggests either a monotonic but curved relationship or a linear coefficient pulled down by a few distant observations. The other way round, a much larger linear coefficient usually means those same distant points have pulled it up. Either way the scatter plot settles the matter; it is enough to state which coefficient you report and why you chose it, and reporting both is an accepted practice.

References

  • Siegel, S., & Castellan, N. J. (1988). Nonparametric Statistics for the Behavioral Sciences
  • Field, A. (2018). Discovering Statistics Using IBM SPSS Statistics
  • Spearman, C. (1904). The Proof and Measurement of Association between Two Things
  • scipy.stats.spearmanr documentation

Try it with your own data

The free plan includes 50 analysis runs a month and needs no card.