Answered You can hire a professional tutor to get the answer.
For question 2, you will use a subset of the mtcars data. Run the following R oodes and use the Totem-'32 dataset to answer the questions (a)-(d}. R...
Please post R codes used to arrive at the solutions
2. For question 2, you will use a subset of the mtcars data. Run the following R oodes and use the Totem-'32dataset to answer the questions (a)-(d}. R codes: set . seed (50}idx <2— samplaE32 .25,rsplace=FALSE) mtcars2 <2— mtcars[idx ,]mtcarsQlcyl <2— as . factor I: mtcara2$cylj Now, the mtccrsfl data set contains 25 observations. Consider a regression model where the response is mpgand two predictors are weight and cylinder. Note that this time, we treat the cylinder predictor as a categoricalvariable with three categories (4,6,8). Use the MLR model: Y; = ,30 + gamma + fiwjfiw-fi + 501,13ng + e;- wherean is weight, am is 1 if cyl=6 and 0 otherwise, and W152 is 1 if cyl=8 and 0 otherwise. [3.) Obtain the fitted value of mpg at weight = 3, cylinder = 6. [1 pt) [13) At a: = 0.05, test that Ho : 16mg = (15",ng = 0 vs H1 : At least one of flay“; and ficygg is nonzero. [1 pt) Suppose we wonder if there is a significant interaction between the weight and cylinder predictors. Now considera larger model Y" = 30 + Jam-Tu + lacyis‘wii + Jacyiswfl + tautqsafin'wn + fiwezcytsfiflwfl + Ei- Answer ('3) and (‘1)using this model. {c} lUbtain the fitted value of mpg at weight = 3, cylinder = 8. [1 pt) (:1) At a = 0.05, test that H0 : fiwt5cylfi = firstqflg = D vs H1 : At least one of fiwtwm and fiwtwm is nonzero.(1 Pt)