← All procedures

statistics.uStatisticInterval

This function gives the interval of a total over all the sets of `r` units of a population. The data is a uniform sample of `m` of the `n` units, without replacement. An example is the count of crossings between all pairs of routes. The input is the total of each sampled unit: the sum of the kernel over the sets of `r` sampled units that hold the unit. Thus the sum of the totals is `r * S`, with `S` the total of the sample. The kernel is symmetric.

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

From the command line

$ mark statistics uStatisticInterval --totals <number[]> --options <object>

As data, in a program

{
  "$proc": ["statistics", "uStatisticInterval"],
  "input": { "totals": [], "options": {} }
}

Input

FieldTypeRequiredDefaultDescription
totalsnumber[]yesThe total of each unit of the sample. The sample has more units than `r`.
optionsobjectyesThe order, the population, the method, the level and the range of the kernel.

Output

FieldTypeRequiredDefaultDescription
estimatenumberyesThe estimate of the total of the population: `S * C(n, r) / C(m, r)`, with `S` the total of the sample.
lownumberyes
highnumberyes
levelnumberyes
method"conservative" | "tight"yesThe method that made the interval. It is not `requested` after a fallback or a choice of the method `"auto"`.
requested"auto" | "conservative" | "tight"yesThe method of the options.
meanobjectyesThe mean of the kernel, with its interval.
subsetsnumberyesThe number of sets of `r` units in the population, `C(n, r)`.
standardErrornumbernoThe standard error of the total. Only an interval of the method `"tight"` has it.
dfnumbernoThe degrees of freedom of the t quantile, `m - 1`. Only an interval of the method `"tight"` has it.
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "totals": {
        "type": "array",
        "items": {
          "type": "number"
        },
        "description": "The total of each unit of the sample. The sample has more units than `r`."
      },
      "options": {
        "type": "object",
        "properties": {
          "order": {
            "type": "number",
            "description": "The order `r` of the kernel: the number of units in each set. It is a whole number of 1 or more."
          },
          "population": {
            "type": "number",
            "description": "The number of units in the whole population, `n`. It is a whole number, and it is not less than the sample."
          },
          "method": {
            "type": "string",
            "enum": [
              "auto",
              "conservative",
              "tight"
            ],
            "description": "The method of the interval. The methods `\"conservative\"` and `\"auto\"` need `range`."
          },
          "level": {
            "type": "number",
            "description": "The level of the interval. The default is 0.95."
          },
          "range": {
            "type": "array",
            "items": [
              {
                "type": "number"
              },
              {
                "type": "number"
              }
            ],
            "additionalItems": {},
            "minItems": 2,
            "maxItems": 2,
            "description": "The smallest and the largest value of the kernel. With it, the interval stays in this range."
          }
        },
        "required": [
          "order",
          "population",
          "method"
        ],
        "additionalProperties": {},
        "description": "The order, the population, the method, the level and the range of the kernel."
      }
    },
    "required": [
      "totals",
      "options"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "estimate": {
        "type": "number",
        "description": "The estimate of the total of the population: `S * C(n, r) / C(m, r)`, with `S` the total of the sample."
      },
      "low": {
        "type": "number"
      },
      "high": {
        "type": "number"
      },
      "level": {
        "type": "number"
      },
      "method": {
        "type": "string",
        "enum": [
          "conservative",
          "tight"
        ],
        "description": "The method that made the interval. It is not `requested` after a fallback or a choice of the method `\"auto\"`."
      },
      "requested": {
        "type": "string",
        "enum": [
          "auto",
          "conservative",
          "tight"
        ],
        "description": "The method of the options."
      },
      "mean": {
        "type": "object",
        "properties": {
          "estimate": {
            "type": "number",
            "description": "The U-statistic: the mean of the kernel over the sets of `r` units of the sample."
          },
          "low": {
            "type": "number"
          },
          "high": {
            "type": "number"
          }
        },
        "required": [
          "estimate",
          "low",
          "high"
        ],
        "additionalProperties": {},
        "description": "The mean of the kernel, with its interval."
      },
      "subsets": {
        "type": "number",
        "description": "The number of sets of `r` units in the population, `C(n, r)`."
      },
      "standardError": {
        "type": "number",
        "description": "The standard error of the total. Only an interval of the method `\"tight\"` has it."
      },
      "df": {
        "type": "number",
        "description": "The degrees of freedom of the t quantile, `m - 1`. Only an interval of the method `\"tight\"` has it."
      }
    },
    "required": [
      "estimate",
      "low",
      "high",
      "level",
      "method",
      "requested",
      "mean",
      "subsets"
    ],
    "additionalProperties": {}
  }
}