plot_pos#
- scikitplot.probscale.plot_pos(data, postype=None, alpha=None, beta=None, exceedance=False)[source]#
Compute the plotting positions for a dataset. Heavily borrows from
scipy.stats.mstats.plotting_positions
.A plotting position is defined as:
(i-alpha)/(n+1-alpha-beta)
where:i
is the rank ordern
is the size of the datasetalpha
andbeta
are parameters used to adjust the positions.
The values of
alpha
andbeta
can be explicitly set. Typical values can also be access via thepostype
parameter. Availablepostype
values (alpha, beta) are:- “type 4” (alpha=0, beta=1)
Linear interpolation of the empirical CDF.
- “type 5” or “hazen” (alpha=0.5, beta=0.5)
Piecewise linear interpolation.
- “type 6” or “weibull” (alpha=0, beta=0)
Weibull plotting positions. Unbiased exceedance probability for all distributions. Recommended for hydrologic applications.
- “type 7” (alpha=1, beta=1)
The default values in R. Not recommended with probability scales as the min and max data points get plotting positions of 0 and 1, respectively, and therefore cannot be shown.
- “type 8” (alpha=1/3, beta=1/3)
Approximately median-unbiased.
- “type 9” or “blom” (alpha=0.375, beta=0.375)
Approximately unbiased positions if the data are normally distributed.
- “median” (alpha=0.3175, beta=0.3175)
Median exceedance probabilities for all distributions (used in
scipy.stats.probplot
).- “apl” or “pwm” (alpha=0.35, beta=0.35)
Used with probability-weighted moments.
- “cunnane” (alpha=0.4, beta=0.4)
Nearly unbiased quantiles for normally distributed data. This is the default value.
- “gringorten” (alpha=0.44, beta=0.44)
Used for Gumble distributions.
- Parameters:
- dataarray-like
The values whose plotting positions need to be computed.
- postypestring, optional (default: “cunnane”)
- alpha, betafloat, optional
Custom plotting position parameters is the options available through the
postype
parameter are insufficient.- exceedancebool, optional (default: False)
Toggles “exceedance” vs “non-exceedance” probabilily plots. By default, non-exceedance plots are drawn where the plot generally slopes from the lower left to the upper right, and show the probability that a new observation will be less than a given point. By contrast, exceedance plots show the probability that a new observation will be greater than a given point.
- Returns:
- plot_posnumpy.array
The computed plotting positions, sorted.
- data_sortednumpy.array
The original data values, sorted.
References
https://rdrr.io/cran/lmomco/man/pp.html http://astrostatistics.psu.edu/su07/R/html/stats/html/quantile.html http://docs.scipy.org/doc/scipy-0.17.0/reference/generated/scipy.stats.probplot.html http://docs.scipy.org/doc/scipy-0.17.0/reference/generated/scipy.stats.mstats.plotting_positions.html