Quantile

Edit this page

The quantile transform calculates empirical quantile values for an input data stream. If a groupby parameter is provided, quantiles are estimated separately per group. Among other uses, the quantile transform is useful for creating quantile-quantile (Q-Q) plots.

// Any View Specification
{
  ...
  "transform": [
    {"quantile": ...} // Quantile Transform
     ...
  ],
  ...
}

Density Transform Definition

Property Type Description
quantile FieldName

Required. The data field for which to perform quantile estimation.

groupby FieldName[]

The data fields to group by. If not specified, a single group containing all data objects will be used.

probs Number[]

An array of probabilities in the range (0, 1) for which to compute quantile values. If not specified, the step parameter will be used.

step Number

A probability step size (default 0.01) for sampling quantile values. All values from one-half the step size up to 1 (exclusive) will be sampled. This parameter is only used if the probs parameter is not provided.

as Any[]

The output field names for the probability and quantile values.

Default value: ["prob", "value"]

Usage

{"quantile": "measure", "probs": [0.25, 0.5, 0.75]}

Computes the quartile boundaries for the "measure" field. The output data is of the form:

[{prob: 0.25, value: 1.34}, {prob: 0.5, value: 5.82}, {prob: 0.75, value: 9.31}];
{"quantile": "measure", "step": 0.05}

Computes quantiles for the "measure" field over equal-sized probability steps. The output data is of the form:

[{prob: 0.025, value: 0.01}, {prob: 0.075, value: 0.02}, ...{prob: 0.975, value: 0.2}];

Example: Quantile-Quantile Plot

A quantile-quantile plot comparing input data to theoretical distributions: