Skip to content

Main content

Spearman Rank Correlation Calculator

Calculate Spearman correlation using one-based average ranks and the existing Pearson calculation's numeric precision, returning both rank vectors without a p-value.

Loading tool…

Description

Calculate Spearman correlation using one-based average ranks and the existing Pearson calculation's numeric precision, returning both rank vectors without a p-value.

Spearman correlation compares the ranks of paired observations rather than their numeric spacing. It summarizes monotonic association; tied values need a stated ranking convention and the coefficient alone does not test statistical significance.1

Calculate Spearman correlation using one-based average ranks and the existing Pearson calculation's numeric precision, returning both rank vectors without a p-value.

When to use this tool

Use this tool to calculate spearman rank correlation under the units, normalization, and boundary conventions below.

How to use the tool and how it works

  1. Supply first, second in the field shapes below.
  2. Run the calculation. Correct format, shape, range, or undefined-statistic errors before interpreting a result.
  3. Read correlation, firstRanks, secondRanks. Use the conventions below.

Rank each equal-length series from one, assigning tied values their average rank, then calculate Pearson correlation of the rank vectors. Return both rank vectors with the coefficient.2

Delegated operations used for this result: pearson correlation. Their calculation or parsing conventions apply to the corresponding result fields.3

Input fieldMeaning and unitsAccepted input
firstFirst paired seriesRequired. Array of Finite number.; minimum items 2; maximum items 512.
secondSecond paired seriesRequired. Array of Finite number.; minimum items 2; maximum items 512.
Output fieldInterpretationReturned shape
correlationSpearman correlationRequired. Finite number; minimum -1; maximum 1.
firstRanksFirst average ranksRequired. Array of Finite number.; minimum items 2; maximum items 512.
secondRanksSecond average ranksRequired. Array of Finite number.; minimum items 2; maximum items 512.
json
{
  "input": {
    "first": [
      10,
      20,
      30
    ],
    "second": [
      30,
      10,
      20
    ]
  },
  "output": {
    "correlation": -0.5,
    "firstRanks": [
      1,
      2,
      3
    ],
    "secondRanks": [
      3,
      1,
      2
    ]
  }
}

Limitations and assumptions

  • Either constant series makes correlation undefined and is rejected. The coefficient uses the existing Pearson calculation’s numerical precision and does not include a p-value or demonstrate causality.
  • The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.

Alternative or Complementary methods

Choose the statistic according to the question and data conventions. Inspect the supplied series or matrix and the stated assumptions before comparing outputs from implementations with different defaults.

References

  1. SciPy: Spearman correlation — SciPy

  2. Tool behavior and example: Spearman Rank Correlation Calculator — tool.io

  3. Calculation or validation: statistics/pearson-correlation — tool.io

Similar or alternative tools

  • kendall tau

    Calculate tie-adjusted Kendall tau-b and disjoint concordant, discordant, and tied pair counts, without a p-value approximation.

  • rank sum test case

    Generate independent samples on caller-specified inclusive integer lattices, controlling ties and range separation, and delegate tie-aware Mann–Whitney U statistics; report cross-sample tie pairs and model ranges without inventing p-values or a continuous-distribution assumption.