Do cars with larger engines tend to use more fuel?
- Engine size can be measured using displacement.
- Fuel efficiency is measured in miles per gallon (MPG).
- We will examine the relationship using statistics and graphs.
October 25, 2026
Do cars with larger engines tend to use more fuel?
We will use the built-in R dataset mtcars.
disp is engine displacement in cubic inches.mpg is miles driven per gallon of fuel.## car disp mpg ## Mazda RX4 Mazda RX4 160 21.0 ## Mazda RX4 Wag Mazda RX4 Wag 160 21.0 ## Datsun 710 Datsun 710 108 22.8 ## Hornet 4 Drive Hornet 4 Drive 258 21.4 ## Hornet Sportabout Hornet Sportabout 360 18.7
Correlation measures how strongly two numerical variables move together.
Here we expect a negative correlation: larger engines often have lower MPG.
Pearson’s correlation coefficient is
\[ r = \frac{\sum_{i=1}^{n}(x_i-\bar{x})(y_i-\bar{y})} {\sqrt{\sum_{i=1}^{n}(x_i-\bar{x})^2}\sqrt{\sum_{i=1}^{n}(y_i-\bar{y})^2}} \]
For our data, \(x\) is engine displacement and \(y\) is MPG.
The calculated correlation is -0.848.
A simple linear regression line is written as
\[ \hat{y} = b_0 + b_1x \]
Here, \(\hat{y}\) is predicted MPG and \(x\) is displacement.
Our estimated equation is
\[ \widehat{MPG} = 29.6 + (-0.0412) \times displacement \]
The slope is negative, meaning predicted MPG falls as displacement increases.
This is the main R code used for the analysis.
cars <- mtcars cor(cars$disp, cars$mpg) fit <- lm(mpg ~ disp, data = cars) summary(fit)
The built-in dataset makes this analysis easy to reproduce.
The downward trend suggests larger engines generally have lower MPG.
Cars with more cylinders tend to have lower fuel efficiency in this dataset.
Hover over any point to see which car it represents.
Overall, engine size is a useful predictor of fuel efficiency in the mtcars dataset.