← All procedures

statistics.smoothLawScores

This function gives the mean log density of the values under each smooth law, at the closed-form fit of that law. Each law has 2 fitted numbers, so the function adds no penalty. The uniform, the shifted exponential and the Pareto law take the smallest value as their lower limit. This fitted end helps them at small sizes. All values are exact maximum likelihoods. The function throws a RangeError for an empty list, for a value that is not positive and finite, or for equal values.

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

From the command line

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

As data, in a program

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

Input

FieldTypeRequiredDefaultDescription
valuesnumber[]yes

Output

The schema does not list fields (object[]).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "values": {
        "type": "array",
        "items": {
          "type": "number"
        }
      }
    },
    "required": [
      "values"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "array",
    "items": {
      "type": "object",
      "properties": {
        "law": {
          "type": "string",
          "enum": [
            "exponential",
            "log-normal",
            "normal",
            "pareto",
            "uniform"
          ]
        },
        "meanLogDensity": {
          "type": "number",
          "description": "The mean log density of the values at the fit of the law. A larger value is a better fit."
        }
      },
      "required": [
        "law",
        "meanLogDensity"
      ],
      "additionalProperties": {}
    }
  }
}