The Weibull distribution is a continuous probability distribution widely used in reliability engineering and survival analysis. It generalises the Exponential Distribution by allowing the hazard rate to increase or decrease over time.
A random variable \(X\) follows a Weibull distribution with shape parameter \(k > 0\) and scale parameter \(\lambda > 0\) if
Interpretation: The shape \(k\) controls the hazard: \(k < 1\) gives a decreasing failure rate (early-life failures), \(k = 1\) a constant rate (the exponential case), and \(k > 1\) an increasing rate (wear-out).
Plotting code
import numpy as npimport matplotlib.pyplot as pltimport seaborn as snsfrom scipy.stats import weibull_minsns.set_style('whitegrid')sns.set_palette('Set2')x = np.linspace(0, 2.5, 400)fig, ax = plt.subplots(figsize=(7, 4))for k in (0.5, 1.0, 1.5, 3.0): ax.plot(x, weibull_min.pdf(x, k), lw=2, label=rf'$k = {k}$')ax.set_xlabel('$x$')ax.set_ylabel('$f(x)$')ax.set_title(r'Weibull density ($\lambda = 1$)')ax.set_ylim(0, 2)ax.legend()plt.show()
/Users/johnrobininston/Brain/Courses/PSTAT100/pstat100-2026-spring/.venv-pstat100-2026-spring/lib/python3.12/site-packages/scipy/stats/_continuous_distns.py:2760: RuntimeWarning: divide by zero encountered in power
return c*pow(x, c-1)*np.exp(-pow(x, c))
Density of the Weibull distribution (\(\lambda = 1\)) for several shape parameters \(k\).