Simple linear regression is a statistical method used to understand the relationship between two numerical variables.
In this presentation, we will explore how vehicle weight affects fuel efficiency.
We will use the built-in mtcars dataset in R.
Simple linear regression is a statistical method used to understand the relationship between two numerical variables.
In this presentation, we will explore how vehicle weight affects fuel efficiency.
We will use the built-in mtcars dataset in R.
Simple linear regression describes the relationship between a dependent variable and an independent variable.
The statistical model is:
\[ Y_i = \beta_0 + \beta_1 X_i + \varepsilon_i \]
Where:
The built-in mtcars dataset contains 32 automobiles and 11 numerical variables.
Our analysis focuses on two variables:
Research Question: Can vehicle weight predict fuel efficiency?
| Variable | Mean | Minimum | Maximum |
|---|---|---|---|
| MPG | 20.09 | 10.40 | 33.90 |
| Weight | 3.22 | 1.51 | 5.42 |
This scatter plot shows the relationship between vehicle weight and fuel efficiency.
The fitted regression line shows the estimated relationship between vehicle weight and MPG.
Interpretation: The downward-sloping red line indicates that heavier vehicles tend to have lower fuel efficiency.
Explore the relationship between vehicle weight, horsepower, and fuel efficiency.
We use the lm() function to predict fuel efficiency based on vehicle weight.
model <- lm(mpg ~ wt, data = mtcars) summary(model) predict(model, newdata = data.frame(wt = 3))
The model estimates fuel efficiency for a vehicle weighing 3,000 pounds.
The fitted regression equation is:
\[ \widehat{MPG} = 37.285 - 5.344 \times Weight \]
For a vehicle weighing 3,000 pounds:
\[ \widehat{MPG} = 37.285 - 5.344(3) \]
\[ \widehat{MPG} \approx 21.25 \]
Interpretation: A vehicle weighing 3,000 pounds is predicted to achieve approximately 21.25 miles per gallon according to this model.
Key Findings:
Limitations:
Conclusion: Simple linear regression helps identify statistical relationships and make data-driven predictions.