statistics.quantileSorted
The `p` quantile of a list that is already sorted. Use it when you take several quantiles of one list. The linear method gives the same numbers as the copies in highways, packing and layout-contract. The nearest-rank method gives the same numbers as the copies in lag, lag-hud and the backtest of highways. The higher method gives the upper median of the copies in highways with `p = 0.5`.
CLI- Package
- @procedures/statistics · README
- Path
["statistics","quantileSorted"]- CLI
mark statistics quantileSorted --sortedValues <number[]> --p <number>- As data
{"$proc":["statistics","quantileSorted"],"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","quantileSorted"], { sortedValues: [], p: 1 });
console.log(JSON.stringify(result));From the command line
$ mark statistics quantileSorted --sortedValues <number[]> --p <number>
As data, in a program
{
"$proc": ["statistics", "quantileSorted"],
"input": { "sortedValues": [], "p": 1 }
}Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
sortedValues | number[] | yes | ||
p | number | yes | ||
method | "higher" | "linear" | "nearest-rank" | no |
Output
The schema does not list fields (number).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"sortedValues": {
"type": "array",
"items": {
"type": "number"
}
},
"p": {
"type": "number"
},
"method": {
"type": "string",
"enum": [
"higher",
"linear",
"nearest-rank"
]
}
},
"required": [
"sortedValues",
"p"
],
"additionalProperties": false
},
"output": {
"type": "number"
}
}