ppcc_plot(x, a, b, dist='tukeylambda', plot=None, N=80)
The probability plot correlation coefficient (PPCC) plot can be used to determine the optimal shape parameter for a one-parameter family of distributions. It cannot be used for distributions without shape parameters (like the normal distribution) or with multiple shape parameters.
By default a Tukey-Lambda distribution (stats.tukeylambda) is used. A Tukey-Lambda PPCC plot interpolates from long-tailed to short-tailed distributions via an approximately normal one, and is therefore particularly useful in practice.
Input array.
Lower and upper bounds of the shape parameter to use.
Distribution or distribution function name. Objects that look enough like a stats.distributions instance (i.e. they have a ppf
method) are also accepted. The default is 'tukeylambda'
.
If given, plots PPCC against the shape parameter. plot is an object that has to have methods "plot" and "text". The matplotlib.pyplot(?) module or a Matplotlib Axes object can be used, or a custom object with the same methods. Default is None, which means that no plot is created.
The shape values for which ppcc was calculated.
The calculated probability plot correlation coefficient values.
Calculate and optionally plot probability plot correlation coefficient.
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
rng = np.random.default_rng()
c = 2.5
x = stats.weibull_min.rvs(c, scale=4, size=2000, random_state=rng)
fig1, ax = plt.subplots(figsize=(9, 4))
ax.hist(x, bins=50)
ax.set_title('Histogram of x')
plt.show()
fig2 = plt.figure(figsize=(12, 4))
ax1 = fig2.add_subplot(1, 3, 1)
ax2 = fig2.add_subplot(1, 3, 2)
ax3 = fig2.add_subplot(1, 3, 3)
res = stats.probplot(x, plot=ax1)
res = stats.boxcox_normplot(x, -4, 4, plot=ax2)
res = stats.ppcc_plot(x, c/2, 2*c, dist='weibull_min', plot=ax3)
ax3.axvline(c, color='r')
plt.show()
The following pages refer to to this document either explicitly or contain code examples using this.
scipy.stats._morestats:ppcc_max
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them