[SciPy-User] example stats.probplot

josef.pktd at gmail.com josef.pktd at gmail.com
Tue Aug 25 23:19:57 EDT 2009


Just an example of what's still waiting in scipy.stats.

Josef
-------------- next part --------------
'''Example: stats.probplot

'''

import numpy as np
from scipy import stats
import matplotlib.pyplot as plt

nsample = 100
np.random.seed(7654321)

plt.subplot(221)
# t distribution with small degrees of freedom
x = stats.t.rvs(3, size=nsample)
stats.probplot(x, plot=plt)

plt.subplot(222)
# t distribution with larger degrees of freedom
x = stats.t.rvs(25, size=nsample)
stats.probplot(x, plot=plt)

plt.subplot(223)
# mixture of 2 normal distributions with broadcasting
x = stats.norm.rvs(loc=[0,5], scale=[1,1.5], size=(nsample/2.,2)).ravel()
stats.probplot(x, plot=plt)

plt.subplot(224)
# standard normal distribution
x = stats.norm.rvs(loc=0, scale=1, size=nsample)
stats.probplot(x, plot=plt)

#plt.show()


More information about the SciPy-User mailing list