The comparison of a candidate with a baseline, from the ratio candidate / baseline of each input. It answers the three questions of a promotion. How often is the candidate better? By how much? How often is it worse beyond the noise? A promotion reads `gains` against `drops` and `effect`, not `signP` alone, because a sign test counts a win of any size.
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","compareRatios"], { ratios: [] });
console.log(JSON.stringify(result));From the command line
$ mark statistics compareRatios --ratios <number[]>
As data, in a program
{ "$proc": ["statistics", "compareRatios"], "input": { "ratios": [] } }JSON Schemas
{
"input": {
"type": "object",
"properties": {
"ratios": {
"type": "array",
"items": {
"type": "number"
}
},
"options": {
"type": "object",
"properties": {
"better": {
"type": "string",
"enum": [
"higher",
"lower"
],
"description": "\"higher\" (the default): a ratio above 1 is a gain. \"lower\": a ratio below 1 is a gain, as for a time or a cost."
},
"tie": {
"type": "number",
"description": "A ratio at this distance from 1 or nearer is a tie. The default is 0: only a ratio of exactly 1 is a tie."
},
"noise": {
"type": "number",
"description": "A gain or a loss counts only beyond this distance from 1. The default is 0. Use noiseFloor."
}
},
"additionalProperties": {}
}
},
"required": [
"ratios"
],
"additionalProperties": false
},
"output": {
"type": "object",
"properties": {
"n": {
"type": "number",
"description": "The number of inputs."
},
"ties": {
"type": "number"
},
"wins": {
"type": "number",
"description": "The inputs where the candidate is better, by any amount."
},
"losses": {
"type": "number",
"description": "The inputs where the candidate is worse, by any amount."
},
"signP": {
"type": "number",
"description": "The one-sided sign test of wins against losses."
},
"effect": {
"type": "object",
"properties": {
"n": {
"type": "number"
},
"median": {
"type": "number"
},
"p10": {
"type": "number",
"description": "The 0.1 quantile (linear)."
},
"p90": {
"type": "number",
"description": "The 0.9 quantile (linear)."
}
},
"required": [
"n",
"median",
"p10",
"p90"
],
"additionalProperties": {},
"description": "The ratios of the inputs that are not ties, or undefined when each input is a tie."
},
"gains": {
"type": "number",
"description": "The inputs that gain beyond the noise."
},
"drops": {
"type": "number",
"description": "The inputs that lose beyond the noise."
},
"gainShare": {
"type": "number",
"description": "gains / n, with its Wilson interval."
},
"gainInterval": {
"type": "object",
"properties": {
"low": {
"type": "number"
},
"high": {
"type": "number"
}
},
"required": [
"low",
"high"
],
"additionalProperties": {}
},
"dropShare": {
"type": "number",
"description": "drops / n, with its Wilson interval."
},
"dropInterval": {
"type": "object",
"properties": {
"low": {
"type": "number"
},
"high": {
"type": "number"
}
},
"required": [
"low",
"high"
],
"additionalProperties": {}
}
},
"required": [
"n",
"ties",
"wins",
"losses",
"signP",
"gains",
"drops",
"gainShare",
"gainInterval",
"dropShare",
"dropInterval"
],
"additionalProperties": {}
}
}