MATH 314 Homework 12
Due 2026-04-21 by 11:59pm
Download the following dataset into your Homework 12 repository:
mtcars.
Please push this dataset along with your ipynb file for Homework
12.
Your goal is to predict the mile per gallon mpg (fuel efficiency) of
these cars using the explanatory variables weight wt (1000s of
pounds) and the number of carburetors carb. Even though carb is
presented numerically, you should treat it as a qualitative variable,
because half a carburetor is not a thing.
Inside the domain specific language of OLS, you can force a numerical
variable to be treated as a qualitative/categorical variable by
listing it as C(carb) in the formula.
-
Fit a quadratic model across
wt. -
Plot the original data with the quadratic model overlayed.
-
Fit a log10 by log10 model on
wt. -
Plot the original data with the log10 by log10 model overlayed.
-
Calculate mean squared error
for each model. Be sure to calculate
-
Which model has a lower mean squared error?
-
Repeat parts 1., 3., 5., and 6., where each model additionally has unique "intercepts" by
carb.