Chapter 2 Distributions
This chapter introduces one of the most fundamental ideas in statistics, the distribution. We’ll start with frequency tables — which represent the values in a dataset and the number of times each of them appears — and use them to explore data from the National Survey of Family Growth (NSFG). We’ll also look for extreme or erroneous values, called outliers, and consider ways to handle them.
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 matplotlib.pyplot as plt
from thinkstats import decorate
