In [1]:
import numpy as np
import pandas as pd
import plotly.express as px
import sklearn.linear_model as lm
import seaborn as sns
Simple Bootstrap Example¶
Here we work through a simple example of the bootstap when estimating the relationship between miles per gallon and the weight of a vehicle.
Suppose we collected a sample of 20 cars from a population. For the purposes of this demo we will assume that the seaborn dataset is the population. The following is a visualization of our sample:
In [2]:
np.random.seed(42)
mpg_sample = sns.load_dataset('mpg').sample(20)
px.scatter(mpg_sample, x='weight', y='mpg', trendline='ols', width=800)