Introduction

This notebook is used to generate some of the graphs in the lecture.


In [17]:
from __future__ import division

from scipy.stats import norm
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import prettyplotlib as ppl
import brewer2mpl

%matplotlib inline

colors = brewer2mpl.get_map('Set1', 'qualitative', 4).mpl_colors

mpl.rcParams['lines.linewidth'] = 2
mpl.rcParams['lines.color'] = 'r'
mpl.rcParams['axes.titlesize'] = 32
mpl.rcParams['axes.labelsize'] = 24 
mpl.rcParams['axes.labelsize'] = 24 
mpl.rcParams['xtick.labelsize'] = 24 
mpl.rcParams['ytick.labelsize'] = 24 
mpl.rcParams['legend.fontsize'] = 24

Weibull


In [24]:
plt.figure(figsize=(12, 8))
x = np.arange(0.01, 10, 0.01)
delta = 1
fx = lambda x, b, d: (b / d) * (x / d) ** (b - 1) * np.exp(-(x / d) ** b)
for i, beta in enumerate([0.5, 1, 2]):
    plt.plot(x, fx(x, beta, delta), color=colors[i], linestyle='-', label="$\\beta = %.1f, \\delta = %.1f$" % (beta, delta))

beta = 4
delta = 6
plt.plot(x, fx(x, beta, delta), color=colors[3], linestyle='-', label="$\\beta = %.1f, \\delta = %.1f$" % (beta, delta))
plt.legend()
xl = plt.xlabel("$x$")
yl = plt.ylabel("$f_X(x)$")



In [ ]: