← All procedures

statistics.wilson

The Wilson score interval of `k` successes in `n` trials (Wilson, 1927). It keeps its level for a small n and for a proportion near 0 or 1, where the normal interval does not. For n = 0 the interval is 0 to 1.

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

From the command line

$ mark statistics wilson --k <number> --n <number>

As data, in a program

{ "$proc": ["statistics", "wilson"], "input": { "k": 1, "n": 1 } }

Input

FieldTypeRequiredDefaultDescription
knumberyes
nnumberyes
znumberno

Output

FieldTypeRequiredDefaultDescription
lownumberyes
highnumberyes
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "k": {
        "type": "number"
      },
      "n": {
        "type": "number"
      },
      "z": {
        "type": "number"
      }
    },
    "required": [
      "k",
      "n"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "low": {
        "type": "number"
      },
      "high": {
        "type": "number"
      }
    },
    "required": [
      "low",
      "high"
    ],
    "additionalProperties": {}
  }
}