pingouin.harrelldavis(x, quantile=0.5)[source]

Harrell-Davis robust estimate of the \(q^{th}\) quantile of the data.

New in version 0.2.9.


Data, must be a one-dimensional vector.

quantilefloat or array_like

Quantile or sequence of quantiles to compute, must be between 0 and 1. Default is 0.5.

yfloat or array_like

The estimated quantile(s). If quantile is a single quantile, will return a float, otherwise will compute each quantile separately and returns an array of floats.

See also


Shift function.


The Harrell-Davis method [1] estimates the \(q^{th}\) quantile by a linear combination of the order statistics. Results have been tested against the Matlab implementation proposed by [2]. This method is also used to measure the confidence intervals of the difference between quantiles of two groups, as implemented in the shift function [3].



Frank E. Harrell, C. E. Davis, A new distribution-free quantile estimator, Biometrika, Volume 69, Issue 3, December 1982, Pages 635–640,



Rousselet, G. A., Pernet, C. R. and Wilcox, R. R. (2017). Beyond differences in means: robust graphical methods to compare two groups in neuroscience. Eur J Neurosci, 46: 1738-1748.


Estimate the 0.5 quantile (i.e median) of 100 observation picked from a normal distribution with mean=0 and std=1.

>>> import numpy as np
>>> import pingouin as pg
>>> np.random.seed(123)
>>> x = np.random.normal(0, 1, 100)
>>> pg.harrelldavis(x, quantile=0.5)

Several quantiles at once

>>> pg.harrelldavis(x, quantile=[0.25, 0.5, 0.75])
array([-0.84133224, -0.04991657,  0.95897233])