quantile
Syntax
quantile(X, q, [interpolation='linear'])
Details
Calculates values at the given quantile in X.
DolphinDB's quantile features a concise syntax and ignores null
values natively, making it suitable for real-time computation on massive datasets.
NumPy's quantile is designed for multidimensional arrays and
supports passing an array to compute multiple quantiles in batch. SciPy's
quantile not only allows you to specify different quantiles for
each data slice, but also supports the Harrell-Davis statistical estimator and the
nan_policy parameter, so it can handle samples with missing values
natively.
Parameters
X is a numeric vector, matrix or table.
q is a floating number between 0 and 1.
-
'linear' (default): i+(j-i)*fraction, where fraction is the decimal part of q*size(X).
-
'lower': i
-
'higher': j
-
'nearest': i or j whichever is nearest.
-
'midpoint': (i+ j)/2
Returns
A DOUBLE scalar/vector.
Examples
a=[6, 47, 49, 15, 42, 41, 7, 39, 43, 40, 36];
quantile(a,0.25);
// output: 25.5
quantile(a,0.5);
// output: 40
quantile(a,0.75);
// output: 42.5
quantile(a,0.75, 'lower');
// output: 42
Related function: quantileSeries, percentile
