← All procedures

statistics.coverageMinSample

This function applies a fixed bar of coverage to the cells of a study. It gives the smallest sample size `m` from which an interval method keeps its level. The method qualifies at `m` when the cells with a sample of `m` or more pass two tests:

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

From the command line

$ mark statistics coverageMinSample --cells <object[]> --bar <object>

As data, in a program

{
  "$proc": ["statistics", "coverageMinSample"],
  "input": { "cells": [], "bar": {} }
}

Input

FieldTypeRequiredDefaultDescription
cellsobject[]yesThe hits and the draws of each cell. Each cell has its own sample size.
barobjectyesThe level, the alpha of the Holm family and the pooled lower end.

Output

FieldTypeRequiredDefaultDescription
minSamplenumberyesThe smallest sample size `m` of the cells such that each size of `m` or more passes the bar. It is infinite when the largest size fails.
blockingnumbernoThe largest sample size that fails the bar. It blocks each smaller size. The result has no `blocking` when each size passes.
stepsobject[]yesOne step for each sample size of the cells, from the smallest to the largest.
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "cells": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "The name of the cell, for example `\"skewed 120/108\"`. The result names the rejected cells with it."
            },
            "sample": {
              "type": "number",
              "description": "The sample size `m` of the cell, a whole number of 1 or more."
            },
            "hits": {
              "type": "number",
              "description": "The count of samples whose interval holds the true value, a whole number from 0 to `draws`."
            },
            "draws": {
              "type": "number",
              "description": "The count of samples of the cell, a whole number of 1 or more."
            }
          },
          "required": [
            "name",
            "sample",
            "hits",
            "draws"
          ],
          "additionalProperties": {}
        },
        "description": "The hits and the draws of each cell. Each cell has its own sample size."
      },
      "bar": {
        "type": "object",
        "properties": {
          "level": {
            "type": "number",
            "description": "The coverage that the method claims, for example 0.95. Each cell has a one-sided exact binomial test of it."
          },
          "alpha": {
            "type": "number",
            "description": "The level of the Holm family of the cell tests, for example 0.05."
          },
          "pooledLow": {
            "type": "number",
            "description": "The smallest Wilson lower end of the pooled coverage, for example 0.94."
          },
          "z": {
            "type": "number",
            "description": "The z of the Wilson interval. The default is `Z95`."
          }
        },
        "required": [
          "level",
          "alpha",
          "pooledLow"
        ],
        "additionalProperties": {},
        "description": "The level, the alpha of the Holm family and the pooled lower end."
      }
    },
    "required": [
      "cells",
      "bar"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "minSample": {
        "type": "number",
        "description": "The smallest sample size `m` of the cells such that each size of `m` or more passes the bar. It is infinite when the largest size fails."
      },
      "blocking": {
        "type": "number",
        "description": "The largest sample size that fails the bar. It blocks each smaller size. The result has no `blocking` when each size passes."
      },
      "steps": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "sample": {
              "type": "number",
              "description": "The sample size `m` of the step."
            },
            "cells": {
              "type": "number",
              "description": "The count of cells with a sample of `m` or more."
            },
            "rejected": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "The names of the cells that reject the coverage `level`, after the Holm correction."
            },
            "smallestAdjusted": {
              "type": "number",
              "description": "The smallest Holm-adjusted p of the cells of the step."
            },
            "hits": {
              "type": "number",
              "description": "The sum of the hits of the cells of the step."
            },
            "draws": {
              "type": "number",
              "description": "The sum of the draws of the cells of the step."
            },
            "pooled": {
              "type": "object",
              "properties": {
                "low": {
                  "type": "number"
                },
                "high": {
                  "type": "number"
                }
              },
              "required": [
                "low",
                "high"
              ],
              "additionalProperties": {},
              "description": "The Wilson interval of the pooled coverage `hits / draws`."
            },
            "qualifies": {
              "type": "boolean",
              "description": "The sample size `m` passes the two tests of the bar."
            },
            "reason": {
              "type": "string",
              "enum": [
                "cell-rejected",
                "cell-rejected-and-pooled-low",
                "pooled-low",
                "qualifies"
              ]
            }
          },
          "required": [
            "sample",
            "cells",
            "rejected",
            "smallestAdjusted",
            "hits",
            "draws",
            "pooled",
            "qualifies",
            "reason"
          ],
          "additionalProperties": {}
        },
        "description": "One step for each sample size of the cells, from the smallest to the largest."
      }
    },
    "required": [
      "minSample",
      "steps"
    ],
    "additionalProperties": {}
  }
}