statistics.runningSd
This function gives the sample standard deviation of the values (the divisor is n - 1). It needs 2 values or more. Equal values give exactly 0, as `sd` gives. A rounding error cannot make the result NaN.
CLI- Package
- @procedures/statistics · README
- Path
["statistics","runningSd"]- CLI
mark statistics runningSd --s <object>- As data
{"$proc":["statistics","runningSd"],"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","runningSd"], { s: {} });
console.log(JSON.stringify(result));From the command line
$ mark statistics runningSd --s <object>
As data, in a program
{ "$proc": ["statistics", "runningSd"], "input": { "s": {} } }Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
s | object | yes |
Output
The schema does not list fields (number).
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": {}
}
},
"required": [
"s"
],
"additionalProperties": false
},
"output": {
"type": "number"
}
}