statistics.wilsonSampleSize
The smallest number of trials `n` at which the Wilson lower end reaches `target`, when the true proportion is `expected`. Each `n` takes `round(expected × n)` successes. The function gives `undefined` when `expected` is not above `target`, or when no `n` up to `max` reaches it. An audit of an agreement uses it to fix its size.
CLI- Package
- @procedures/statistics · README
- Path
["statistics","wilsonSampleSize"]- CLI
mark statistics wilsonSampleSize --target <number> --expected <number>- As data
{"$proc":["statistics","wilsonSampleSize"],"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","wilsonSampleSize"], { target: 1, expected: 1 });
console.log(JSON.stringify(result));From the command line
$ mark statistics wilsonSampleSize --target <number> --expected <number>
As data, in a program
{
"$proc": ["statistics", "wilsonSampleSize"],
"input": { "target": 1, "expected": 1 }
}Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
target | number | yes | ||
expected | number | yes | ||
z | number | no | ||
max | number | no |
Output
The schema does not list fields (number | null).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"target": {
"type": "number"
},
"expected": {
"type": "number"
},
"z": {
"type": "number"
},
"max": {
"type": "number"
}
},
"required": [
"target",
"expected"
],
"additionalProperties": false
},
"output": {
"type": [
"number",
"null"
]
}
}