Calculate quantiles for a probability plot of sample data against a specified theoretical distribution.
probplot optionally calculates a best-fit line for the data and plots the results using Matplotlib or a given plot function.
Parameters : | x : array_like
sparams : tuple, optional
dist : str, optional
fit : bool, optional
plot : object, optional
|
---|---|
Returns : | (osm, osr) : tuple of ndarrays
(slope, intercept, r) : tuple of floats, optional
|
Notes
Even if plot is given, the figure is not shown or saved by probplot; plot.show() or plot.savefig('figname.png') should be used after calling probplot.
Examples
>>> import scipy.stats as stats
>>> nsample = 100
>>> np.random.seed(7654321)
A t distribution with small degrees of freedom:
>>> ax1 = plt.subplot(221)
>>> x = stats.t.rvs(3, size=nsample)
>>> res = stats.probplot(x, plot=plt)
A t distribution with larger degrees of freedom:
>>> ax2 = plt.subplot(222)
>>> x = stats.t.rvs(25, size=nsample)
>>> res = stats.probplot(x, plot=plt)
A mixture of 2 normal distributions with broadcasting:
>>> ax3 = plt.subplot(223)
>>> x = stats.norm.rvs(loc=[0,5], scale=[1,1.5],
... size=(nsample/2.,2)).ravel()
>>> res = stats.probplot(x, plot=plt)
A standard normal distribution:
>>> ax4 = plt.subplot(224)
>>> x = stats.norm.rvs(loc=0, scale=1, size=nsample)
>>> res = stats.probplot(x, plot=plt)