← All procedures

statistics.mergeRunning

This function gives the summary of the values of two summaries (Chan, Golub and LeVeque, 1979). Thus parallel jobs can each summarize a part. The sum of the merge adds the two sums, so it can differ from the fold in the last bits.

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

From the command line

$ mark statistics mergeRunning --a <object> --b <object>

As data, in a program

{
  "$proc": ["statistics", "mergeRunning"],
  "input": { "a": {}, "b": {} }
}

Input

FieldTypeRequiredDefaultDescription
aobjectyes
bobjectyes

Output

FieldTypeRequiredDefaultDescription
nnumberyesThe count of the values.
sumnumberyesThe sum of the values, added in their order.
minnumberyesThe smallest value, or `Infinity` for no value.
maxnumberyesThe largest value, or `-Infinity` for no value.
m2numberyesThe sum of the squares of the differences from the mean (Welford). `runningSd` reads it.
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "a": {
        "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": {}
      },
      "b": {
        "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": [
      "a",
      "b"
    ],
    "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": {}
  }
}