Skip to main content

Number

Statistics

LineUp-lite computes the following statistics for a numerical attribute:

export interface INumberStats extends IBoxPlot, INumericStats<number> {}

see INumberStats API Docs

Generator Function

The stats generator function has the following signature. It returns a function that can be used to compute statistics for a given array.

export function numberStatsGenerator(
options: NumberStatsOptions = {}
): (arr: readonly number[] | Float32Array | Float64Array) => INumberStats;

see numberStatsGenerator API Docs

Example

Live Editor
Result
{
  "min": 1,
  "max": 98,
  "count": 19,
  "missing": 0,
  "items": [
    43,
    78,
    45,
    38,
    33,
    47,
    45,
    65,
    56,
    98,
    58,
    1,
    58,
    66,
    57,
    85,
    32,
    45,
    75
  ],
  "mean": 53.94736842105263,
  "variance": 454.04986149584494,
  "median": 56,
  "q1": 44,
  "q3": 65.5,
  "iqr": 21.5,
  "outlier": [
    1,
    98
  ],
  "whiskerHigh": 85,
  "whiskerLow": 32,
  "hist": [
    {
      "count": 1,
      "items": [
        1
      ],
      "x0": 1,
      "x1": 17.166666666666668,
      "label": "1 - 17.167",
      "color": "hsl(206, 64%, 29%)"
    },
    {
      "count": 2,
      "items": [
        32,
        33
      ],
      "x0": 17.166666666666668,
      "x1": 33.333333333333336,
      "label": "17.167 - 33.333",
      "color": "hsl(206, 64%, 40%)"
    },
    {
      "count": 6,
      "items": [
        38,
        43,
        45,
        45,
        45,
        47
      ],
      "x0": 33.333333333333336,
      "x1": 49.5,
      "label": "33.333 - 49.5",
      "color": "hsl(206, 64%, 51%)"
    },
    {
      "count": 5,
      "items": [
        56,
        57,
        58,
        58,
        65
      ],
      "x0": 49.5,
      "x1": 65.66666666666667,
      "label": "49.5 - 65.667",
      "color": "hsl(206, 64%, 62%)"
    },
    {
      "count": 3,
      "items": [
        66,
        75,
        78
      ],
      "x0": 65.66666666666667,
      "x1": 81.83333333333334,
      "label": "65.667 - 81.833",
      "color": "hsl(206, 64%, 73%)"
    },
    {
      "count": 2,
      "items": [
        85,
        98
      ],
      "x0": 81.83333333333334,
      "x1": 98,
      "label": "81.833 - 98",
      "color": "hsl(206, 64%, 84%)"
    }
  ],
  "flatMissing": 0,
  "flatItems": [
    43,
    78,
    45,
    38,
    33,
    47,
    45,
    65,
    56,
    98,
    58,
    1,
    58,
    66,
    57,
    85,
    32,
    45,
    75
  ],
  "depth": 1,
  "flatCount": 19,
  "maxBin": {
    "count": 6,
    "items": [
      38,
      43,
      45,
      45,
      45,
      47
    ],
    "x0": 33.333333333333336,
    "x1": 49.5,
    "label": "33.333 - 49.5",
    "color": "hsl(206, 64%, 51%)"
  }
}

Visualization

Cell

NumberBar React component, NumberColor React component, or NumberSymbol React component.

Live Editor
Result
43
43
43
78
78
78
45
45
45

Aggregation

Histogram React component or BoxPlot React component

Live Editor
Result
Minimum: 1 25% Quantile: 44 Median: 56 Mean: 53.947 75% Quantile: 65.5 Maximum: 98 # Items: 19198

Interactive Summary

FilterRangeHistogram React component or FilterRangeBoxPlot React component

Live Editor
Result

Composite: Stacked Bar

StackedBar React component

Live Editor
Result
0.5
0.5
0.7
0.5
3