← All procedures
statistics.addToRunning
This function gives the summary with one more value. It throws a RangeError for NaN, as the functions of a list do. The mean of each step is `sum / n`, so the mean of the fold is the mean of the list.
CLI- Package
- @procedures/statistics · README
- Path
["statistics","addToRunning"]- CLI
mark statistics addToRunning --s <object> --value <number>- As data
{"$proc":["statistics","addToRunning"],"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","addToRunning"], { s: {}, value: 1 });
console.log(JSON.stringify(result));From the command line
$ mark statistics addToRunning --s <object> --value <number>
As data, in a program
{
"$proc": ["statistics", "addToRunning"],
"input": { "s": {}, "value": 1 }
}Input
Output
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"s": {
"type": "object",
"properties": {
"n": {
"type": "number",
"description": "The count of the values."
},
"sum": {
"type": "number",
"description": "The sum of the values, added in their order."
},
"min": {
"type": "number",
"description": "The smallest value, or `Infinity` for no value."
},
"max": {
"type": "number",
"description": "The largest value, or `-Infinity` for no value."
},
"m2": {
"type": "number",
"description": "The sum of the squares of the differences from the mean (Welford). `runningSd` reads it."
}
},
"required": [
"n",
"sum",
"min",
"max",
"m2"
],
"additionalProperties": {}
},
"value": {
"type": "number"
}
},
"required": [
"s",
"value"
],
"additionalProperties": false
},
"output": {
"type": "object",
"properties": {
"n": {
"type": "number",
"description": "The count of the values."
},
"sum": {
"type": "number",
"description": "The sum of the values, added in their order."
},
"min": {
"type": "number",
"description": "The smallest value, or `Infinity` for no value."
},
"max": {
"type": "number",
"description": "The largest value, or `-Infinity` for no value."
},
"m2": {
"type": "number",
"description": "The sum of the squares of the differences from the mean (Welford). `runningSd` reads it."
}
},
"required": [
"n",
"sum",
"min",
"max",
"m2"
],
"additionalProperties": {}
}
}