Question 11.107

11.107 Predicting CO2 emissions.

The data set CO2MPG contains an SRS of 200 passenger vehicles sold in Canada in 2014. There appears to be a quadratic relationship between CO2 emissions and mile per gallon highway(MPGHWY).

co2mpg

  1. Create two new centered variables and and fit a quadratic regression for each fuel type (FUELTYPE). Create a table of parameter estimates and comment on the similarities and differences in the coefficients across fuel types.
  2. Create three indicator variables for fuel type, three interaction variables between MPG and each of the indicators, and three interaction variables between MPG2 and each the indicator variables. Fit this model to the entire data set. Use the estimate coefficients to construct the quadratic equation for each of the fuel types. How do they compare to the equations in part (a)?

11.107

(a)

Regression Coefficients
Type Intercept mpg mpg2
D 267.3823 −5.42585 0.04619
E 160.84557 −3.89582 0.30631
X 235.16637 −7.18033 0.12751
Z 243.75987 −7.88188 0.13832

Type X and Z are very similar and show very few differences in all of the coefficients. Types D and E are very different. Type E has a much smaller slope for MPG than all the other types, and the MPG2 effect is quite large—more than double all the rest. Type D also has a slightly smaller slope for MPG than X and, but it has an extremely small slope for MPG2.

(b)

Parameter Estimate
Intercept 243.75987
X1 23.62243
X2 −82.91430
X3 −8.59350
mpg −7.88188
MPGX1 2.45603
MPGX2 3.98607
MPGX3 0.70155
mpg2 0.13832
MPG2X1 −0.09214
MPG2X2 0.16798
MPG2X3 −0.01081

S-34

Answers will vary depending on how the indicator variables were created. Setting Z has the default type ; the parameter estimates are in the table shown. So the estimates for the Intercept, MPG, and MPG2 will match type Z’s estimates exactly. To recoup the others, we just set and for Type D, etc., yielding an intercept of , a slope for MPG of , and a slope for MPG2 of , etc. This yields the same equations as part (a).