← All procedures

statistics.spearman

The Spearman rank correlation: the Pearson correlation of the ranks, with mean ranks for ties. The value is from -1 to 1. When one list has no spread, the value is 0. It is equal to the copy in the backtest of highways.

CLI
Package
@procedures/statistics · README
Path
["statistics","spearman"]
CLI
mark statistics spearman --a <number[]> --b <number[]>
As data
{"$proc":["statistics","spearman"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/statistics/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["statistics","spearman"], { a: [], b: [] });
console.log(JSON.stringify(result));

From the command line

$ mark statistics spearman --a <number[]> --b <number[]>

As data, in a program

{ "$proc": ["statistics", "spearman"], "input": { "a": [], "b": [] } }

Input

FieldTypeRequiredDefaultDescription
anumber[]yes
bnumber[]yes

Output

The schema does not list fields (number).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "a": {
        "type": "array",
        "items": {
          "type": "number"
        }
      },
      "b": {
        "type": "array",
        "items": {
          "type": "number"
        }
      }
    },
    "required": [
      "a",
      "b"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "number"
  }
}