← All procedures

statistics.quantileSamples

This function gives the fewest independent values that give the quantile `p` an upper bound at `level`: the smallest n with p^n <= (1 - level) / 2. With that n, the upper bound is the largest value. At the level 0.95, p95 needs 72 values, p99 needs 368 values and p99.9 needs 3,688 values.

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

From the command line

$ mark statistics quantileSamples --p <number>

As data, in a program

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

Input

FieldTypeRequiredDefaultDescription
pnumberyes
levelnumberno

Output

The schema does not list fields (number).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "p": {
        "type": "number"
      },
      "level": {
        "type": "number"
      }
    },
    "required": [
      "p"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "number"
  }
}