Opens in a new tab

METHOD GUIDE

Spearman Correlation in R
Ties, Exact p-Values and What the Warning Means

With tied values in the data, cor.test() warns that it cannot compute an exact p-value and falls back on an approximation. The warning is not an error, but it decides which p-value you are reporting and what the methods must say about it.

IN SHORT

What Rank Correlation Measures and How R Reports It

Spearman’s rho is the correlation between the ranks of two variables, so it measures how consistently one variable rises or falls with the other without requiring a straight line. To run a Spearman correlation in R, call cor.test(x, y, method = “spearman”), read rho and the p-value, and note whether that p-value is exact or approximate. Spearman’s rho in R suits ordinal items and monotone but curved patterns. It still needs one independent pair per case, and base R prints no confidence interval for it. OnlineSPSS, a specialist statistical consultancy for academic, clinical and professional research, carries out and reviews this analysis through an in-house PhD-level statistician.

ANALYSIS SUPPORT

Analysis Support for This Method

Choosing a rank-based coefficient is a decision about the measurement scale and the shape of the relationship, and the console warning is only a symptom of that choice.

Correlation Analysis (Pearson & Spearman)

Rank-based and linear association measures for your variables, with the tie handling, any interval and the reporting wording settled before the analysis starts.

Explore Correlation Analysis (Pearson & Spearman)
Likert Scale Analysis

Analysis of ordinal survey items and scale scores, for when the variables are rating-scale responses and the question is how they are summarized and related.

Explore Likert Scale Analysis

BEFORE YOU RUN IT

What Rank Correlation Assumes About Your Variables

Ranks relax the demand for linearity but not the demand for a design with one independent pair per case, so these four points are settled before a rank correlation in R is run.

A Monotone Pattern Rho captures a relationship that consistently rises or falls, even if curved. A U-shaped cloud gives a rho near zero, which the scatterplot shows and the coefficient does not.

Ordinal or Continuous Scales Rating items and continuous measures can both be ranked. Variables with only a handful of distinct values produce many ties, and for those the p-value behaves differently.

Ties Counted in Advance Tied values share an average rank. They leave rho defined but rule out the exact p-value, so count them with table() and say how common they are.

Cases Unrelated to Each Other A rank method is not assumption-free. Repeated measurements on the same people, or cases clustered in groups, break independence and the printed p-value no longer applies.

IN R

How to Run a Spearman Correlation in R

Base R handles the coefficient and its test with cor.test(). An interval needs an add-on or a resampling routine, so the package, its version and the method used are written down.

  1. Confirm the design: two ordinal or continuous variables and one pair per case.
  2. Plot the pairs with plot(jitter(x), jitter(y)) so that repeated values stay visible.
  3. Count tied values with table() and complete pairs with complete.cases().
  4. Run cor.test(x, y, method = “spearman”) and read S, p and rho.
  5. If R warns about ties, accept the approximate p-value and say so, or set exact = FALSE to make the choice explicit.
  6. For an interval, use a resampling routine or an add-on that documents its method, and keep the script.

READING THE OUTPUT

S, rho and the Exact-Test Warning

The block is short, and the warning printed after it, not the numbers inside it, tells you when the p-value is an approximation.

Output element What it tells you What to check
Header line Spearman’s rank correlation rho, with the variables named in the data line That method = “spearman” was set and the Pearson default did not run
S A test statistic derived from the differences between the ranks of each pair That it is not reported as the strength of association, which is rho
p-value Without ties, by default from algorithm AS 89 for fewer than 1,290 pairs; with ties or larger samples, from an approximation Which kind of p it is, and whether the exact argument was set
Warning: Cannot compute exact p-value with ties Tied ranks were present, so the p-value is an approximation That the report says so and states how many values were tied
Alternative hypothesis That the true rho is not equal to 0, unless a direction was requested That a direction was planned before the data were seen
sample estimates: rho The rank correlation, from -1 to 1, with its sign for direction That the sign matches the plot and the number of pairs is stated
Interval None is printed for rank correlations in base R That any interval comes from a named add-on or resampling routine

REPORTING

Wording rho With Its p-Value Type

A rank correlation needs one clause that a linear one does not, namely how ties were handled in the p-value.

Write rs = ___, p = ___, n = ___ pairs, using rs for Spearman’s coefficient, and say in words whether higher values of one variable tend to go with higher or lower values of the other. State whether the p-value was exact or approximate and how many values were tied. Where an interval is added, name the method that produced it, since base R prints none. Show the scatterplot or a plot of the ranks so that the reader can judge the shape. Describe the result as a monotone association, not a straight-line one, and keep to association wording unless the design supports a causal reading.

rs and nExact or Approximate pTies ReportedInterval Method NamedMonotone Wording

COMMON MISTAKES

Rank Correlation Habits That Reviewers Question

A rank method is often treated as the safe default, and that confidence sits behind several of the points below.

Chosen for the Wrong Reason Rho fits ordinal data or a monotone relationship, and a significant normality test is not enough reason to use it. The scale of measurement and the question decide the coefficient.

Warning Suppressed Wrapping the call in suppressWarnings() hides the tie message, and an approximate p-value is then presented as if it were exact. The message is read and its consequence stated.

Many Ties, One Coefficient With many ties, Kendall's tau-b is a rank alternative whose denominator adjusts for tied pairs, and some methodologists prefer it for short rating scales. The coefficient is chosen before the results are seen and named.

Rho Read as Linear Strength A given rho does not describe a straight-line relationship of that strength. It describes how consistently the ranks rise together, and the plot shows the shape.

Continuous Data Cut Into Bands Cutting a continuous variable into a few categories to use a rank method discards information and manufactures ties. A variable measured continuously is analyzed on its measured scale.

Small Samples, Strong Claims With few pairs an exact p-value is available, but rho is imprecise and one pair can move it a long way. The sample size is stated beside the coefficient.

Tied values in your rating data? Independent Statistical Review checks that the coefficient, the type of p-value and the wording agree with one another.

Request an Assessment

FREQUENTLY ASKED QUESTIONS

Questions About Ties and Intervals for Rho

One answer decodes the console warning, one explains the missing interval, and one asks whether rho suits a variable with only two values.

R is telling you that the data contain tied values, so the p-value comes from an approximation and not from the exact distribution of the statistic. The result is not invalid, but the report says that the p-value is approximate and how many values were tied. Setting exact = FALSE gives the same approximate p-value without the message, which is why the choice is stated and not hidden.

Base R’s cor.test() reports an interval only for the Pearson method, so a Spearman call never prints one. To add one, resample the pairs and take percentile limits, or use an add-on that documents its method, and name which in the report. Without an interval, the n and the type of p-value should still be given.

Usually not: a binary variable has only two ranks, so nearly every value is tied and rho becomes a rescaled comparison of the two groups’ ranks. A two-group rank comparison asks that question directly and shows which group tends to score higher. Rho is meant for variables with enough distinct values to order the cases.

By reading the script and the console output side by side, since the call shows whether exact was set and the data show how many values tied. An in-house PhD-level statistician can trace your reported p-value to that call and confirm that the n and the p-value type in your text agree with it, or run the analysis on your data. Presenting the final coefficient belongs to Results Reporting & Interpretation. Interpreting the association for your field is your responsibility as the author.

Your data and project details are handled confidentially, and project information is not published. Researcher names and institutions are not used publicly without permission. An NDA is available where required and can be arranged before sensitive materials are shared. Read more about confidentiality and data security.

You share your research question, design and relevant materials, such as the dataset or the output you have, and a statistically trained Research Coordinator reviews the request and responds the same day. The analysis, deliverables, timeline and one fixed project fee are then confirmed before any work begins, so the timeline follows from the agreed scope.

Still have a question? Find more answers in our full FAQ.

View All FAQs →

NEXT STEP

Can Your Rank Correlation
Withstand a Question About Ties?

How ties were handled shapes the p-value you can report and the sentence that describes it. Attaching the console output and a note on the scale lets the request be assessed against the call you actually ran.

No Commitment Required

Strictly Confidential

Fixed Project Fee

In-House PhD-Level Statisticians

Same-Day Response

Serving Researchers Since 2014