Chapter 5 Modeling Distributions
The distributions we have used so far are called empirical distributions because they are based on data. In this chapter, we’ll look at theoretical distributions, which are mathematical models. And we’ll look at some of the most common distributions: the binomial, Poisson, exponential, normal, and lognormal. For each distribution, we’ll use real-world examples to show that the model fits real data, and discuss what it means when it does.
from os.path import basename, exists
def download(url):
filename = basename(url)
if not exists(filename):
from urllib.request import urlretrieve
local, _ = urlretrieve(url, filename)
print("Downloaded " + local)
download("https://github.com/AllenDowney/ThinkStats/raw/v3/nb/thinkstats.py")
try:
import empiricaldist
except ImportError:
%pip install empiricaldist
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from thinkstats import decorate
