File talk:Weibull qq.svg
Jump to navigation
Jump to search
import numpy as np
import matplotlib.pyplot as plt
## The sample size.
n = 100
## Weibull scale parameter.
lam = 1.0
## Weibull shape parameter.
k = 2.0
## Generate Weibull data.
X = np.random.uniform(size=n)
X = lam*(-np.log(X))**(1/k)
## Convert to order statistics.
X.sort()
## Put in some outliers.
X[-3] += 0.2
X[-2] += 0.5
X[-1] += 1
## Weibull quantiles.
P = np.arange(1, n+1, dtype=np.float64) / (n+1)
Q = lam*(-np.log(1-P))**(1/k)
plt.clf()
plt.figure(figsize=(4,3.5))
plt.axes([0.15,0.15,0.8,0.8])
plt.grid(True)
plt.plot(Q, X, 'o', mec='black', mfc='grey')
plt.hold(True)
plt.plot([0,3], [0,3], '-', color='black')
ii = np.arange(9,91,10)
plt.plot(Q[ii], X[ii], 'o', mec='black', mfc='red')
plt.xlabel("Weibull(1,2) theoretical quantiles", size=14)
plt.ylabel("Data quantiles", size=14)
plt.savefig("weibull_qq.pdf")
plt.savefig("weibull_qq.svg")
Start a discussion about File:Weibull qq.svg
Talk pages are where people discuss how to make content on Wikimedia Commons the best that it can be. You can use this page to start a discussion with others about how to improve File:Weibull qq.svg.