← All procedures

statistics.bestSmoothLaw

This function gives the smooth law with the highest likelihood. Under 300 values the result is not reliable: the normal and the log-normal law lose to the laws with a fitted end. The README gives the measured shares of correct results. The function throws as `smoothLawScores` does.

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

From the command line

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

As data, in a program

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

Input

FieldTypeRequiredDefaultDescription
valuesnumber[]yes

Output

The schema does not list fields ("exponential" | "log-normal" | "normal" | "pareto" | "uniform").

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "values": {
        "type": "array",
        "items": {
          "type": "number"
        }
      }
    },
    "required": [
      "values"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "string",
    "enum": [
      "exponential",
      "log-normal",
      "normal",
      "pareto",
      "uniform"
    ]
  }
}