← All procedures

statistics.sd

The sample standard deviation (the divisor is n - 1). It needs 2 values or more. Equal values give exactly 0. The rounding of the mean gives a small number that is not 0 for some equal values, so the function examines them first.

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

From the command line

$ mark statistics sd --values <number[]>

As data, in a program

{ "$proc": ["statistics", "sd"], "input": { "values": [] } }

Input

FieldTypeRequiredDefaultDescription
valuesnumber[]yes

Output

The schema does not list fields (number).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "values": {
        "type": "array",
        "items": {
          "type": "number"
        }
      }
    },
    "required": [
      "values"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "number"
  }
}