← All procedures

statistics.binomialInterval

The central interval of a count X ~ Binomial(n, p). `low` is the smallest k with P(X <= k) > (1 - level) / 2. `high` is the largest k with P(X >= k) > (1 - level) / 2. Each tail outside the interval holds (1 - level) / 2 or less. The two tails are separate sums, so that a small upper tail keeps its digits.

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

From the command line

$ mark statistics binomialInterval --n <number> --p <number>

As data, in a program

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

Input

FieldTypeRequiredDefaultDescription
nnumberyes
pnumberyes
levelnumberno

Output

FieldTypeRequiredDefaultDescription
lownumberyes
highnumberyes
coveragenumberyesThe chance of a count from `low` to `high`. It is `level` or more.
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "n": {
        "type": "number"
      },
      "p": {
        "type": "number"
      },
      "level": {
        "type": "number"
      }
    },
    "required": [
      "n",
      "p"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "low": {
        "type": "number"
      },
      "high": {
        "type": "number"
      },
      "coverage": {
        "type": "number",
        "description": "The chance of a count from `low` to `high`. It is `level` or more."
      }
    },
    "required": [
      "low",
      "high",
      "coverage"
    ],
    "additionalProperties": {}
  }
}