knitr::opts_chunk$set(eval = FALSE)
Is there an association between the weight and the fuel efficiency of cars? To find out, we use the
mtcars dataset from the
datasets package. The
mtcars data originally came from the 1974 Motor Trend US magazine, and it contains design and performance data on 32 models of automobile.
# ?mtcars # more info head(mtcars)
wt is weight in tons, and
mpg is fuel efficiency in miles per gallon. We want to figure out if there is an association between
mtcars dataset itself only has 32 rows, so we generated two larger bootstrapped datasets. We called them
Then, we fit a couple regression models to the
large to try to detect an association between
mpg. Here are the coefficients and p-values from one of the model fits.
Since the p-value on
x2 is so small, there may be an association between weight and fuel efficiency after all.