← All procedures
statistics.medianInterval
The distribution-free interval of the median of a sample. It needs no assumption about the shape of the distribution. It is x_(k) to x_(n + 1 - k), for the largest k whose two tails each hold (1 - level) / 2 or less. For 11 values at the level 0.95, it is x_(2) to x_(10), with the coverage 0.988.
CLI- Package
- @procedures/statistics · README
- Path
["statistics","medianInterval"]- CLI
mark statistics medianInterval --values <number[]>- As data
{"$proc":["statistics","medianInterval"],"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","medianInterval"], { values: [] });
console.log(JSON.stringify(result));From the command line
$ mark statistics medianInterval --values <number[]>
As data, in a program
{ "$proc": ["statistics", "medianInterval"], "input": { "values": [] } }Input
Output
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"values": {
"type": "array",
"items": {
"type": "number"
}
},
"level": {
"type": "number"
}
},
"required": [
"values"
],
"additionalProperties": false
},
"output": {
"type": "object",
"properties": {
"low": {
"type": "number"
},
"high": {
"type": "number"
},
"rank": {
"type": "number",
"description": "The rank k of `low`, from 1. The interval is from x_(k) to x_(n + 1 - k) of the sorted values."
},
"coverage": {
"type": "number",
"description": "The chance that the interval holds the median of the population: 1 - 2 P(X <= k - 1), for X ~ Binomial(n, 1/2)."
}
},
"required": [
"low",
"high",
"rank",
"coverage"
],
"additionalProperties": {}
}
}