Find percentile and quantile values
Percentiles and quantiles are very similar, differing only in the number used to calculate return values. A percentile is calculated using numbers between 0
and 100
. A quantile is calculated using numbers between 0.0
and 1.0
. For example, the 0.5
quantile is the same as the 50th percentile.
Select a method for calculating the quantile
Select one of the following methods to calculate the quantile:
(Default) An aggregate method that uses a t-digest data structure to compute a quantile estimate on large data sources. Output tables consist of a single row containing the calculated quantile.
If calculating the quantile or 50th percentile:
Given the following input table:
estimate_tdigest
returns:
_value |
---|
1.5 |
If calculating the 0.5
quantile or 50th percentile:
Given the following input table:
exact_mean
returns:
_value |
---|
1.5 |
A selector method that returns the data point for which at least q
points are less than. Output tables consist of a single row containing the calculated quantile.
If calculating the 0.5
quantile or 50th percentile:
Given the following input table:
_time | _value |
---|---|
2020-01-01T00:02:00Z | 1.0 |
The examples below use the .
Use the default method, "estimate_tdigest"
, to return all rows in a table that contain values in the 99th percentile of data in the table.
Find the average of values closest to the quantile
Use the exact_mean
method to return a single row per input table containing the average of the two values closest to the mathematical quantile of data in the table. For example, to calculate the 0.99
quantile:
Use the exact_selector
method to return a single row per input table containing the value that q * 100
% of values in the table are less than. For example, to calculate the quantile:
Use quantile() with aggregateWindow()
aggregateWindow() segments data into windows of time, aggregates data in each window into a single point, and then removes the time-based segmentation. It is primarily used to .
To specify the quantile calculation method in aggregateWindow()
, use the :