← All procedures

statistics.quantile

The `p` quantile of a list.

CLI
Package
@procedures/statistics · README
Path
["statistics","quantile"]
CLI
mark statistics quantile --values <number[]> --p <number>
As data
{"$proc":["statistics","quantile"],"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","quantile"], { values: [], p: 1 });
console.log(JSON.stringify(result));

From the command line

$ mark statistics quantile --values <number[]> --p <number>

As data, in a program

{
  "$proc": ["statistics", "quantile"],
  "input": { "values": [], "p": 1 }
}

Input

FieldTypeRequiredDefaultDescription
valuesnumber[]yes
pnumberyes
method"higher" | "linear" | "nearest-rank"no

Output

The schema does not list fields (number).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "values": {
        "type": "array",
        "items": {
          "type": "number"
        }
      },
      "p": {
        "type": "number"
      },
      "method": {
        "type": "string",
        "enum": [
          "higher",
          "linear",
          "nearest-rank"
        ]
      }
    },
    "required": [
      "values",
      "p"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "number"
  }
}