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
- Supply first, second in the field shapes below.
- Run the calculation. Correct format, shape, range, or undefined-statistic errors before interpreting a result.
- 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 field | Meaning and units | Accepted input |
|---|---|---|
| first | First paired series | Required. Array of Finite number.; minimum items 2; maximum items 512. |
| second | Second paired series | Required. Array of Finite number.; minimum items 2; maximum items 512. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| correlation | Spearman correlation | Required. Finite number; minimum -1; maximum 1. |
| firstRanks | First average ranks | Required. Array of Finite number.; minimum items 2; maximum items 512. |
| secondRanks | Second average ranks | Required. Array of Finite number.; minimum items 2; maximum items 512. |
{
"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
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.