[Numpy-discussion] Getting 95%/99% margin of ndarray
Pierre GM
pgmdevlist at gmail.com
Wed Jul 22 13:26:42 EDT 2009
On Jul 22, 2009, at 12:36 PM, Johannes Bauer wrote:
> Hello list,
>
> is there some possibilty to get a p-dynamic of an array, i.e. if p=1
> then the result would be (arr.min(), arr.max()), but if 0 < p < 1,
> then
> the result is so that the pth percentile of the picture is withing the
> range given?
You could try scipy.stats.scoreatpercentile,
scipy.stats.mstats.plottingposition or scipy.stats.mstats.mquantiles,
which will all approximate quantiles of your distribution.
To get the 90% of data you want, find the (0.05, 0.95) quantiles. More
generally, to get n% data, take the (n/2)% and (1.-n/2)% quantiles...
Even more approximately, you could sort your data and take the (n/2)N
and (1-n/2)N ones, where n is the quantile you want and N the size of
your array.
More information about the NumPy-Discussion
mailing list