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)
Here, 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 wt
and mpg
. The mtcars
dataset itself only has 32 rows, so we generated two larger bootstrapped datasets. We called them small
and large
.
head(drake::readd(small)) # 48 rows drake::loadd(large) # 64 rows head(large)
Then, we fit a couple regression models to the small
and large
to try to detect an association between wt
and mpg
. Here are the coefficients and p-values from one of the model fits.
drake::readd(coef_regression2_small)
Since the p-value on x2
is so small, there may be an association between weight and fuel efficiency after all.
Because of the calls to readd()
and loadd()
, drake
knows that small
, large
, and coef_regression2_small
are dependencies of this R Markdown report. This dependency relationship is what causes the report to be processed at the very end.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.