# For Question 2 You Will Use A Subset Of The Mtcars Data Run The Following R Oode

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 &lt;2— samplaE32 .25,rsplace=FALSE) mtcars2 &lt;2— mtcars[idx ,]mtcarsQlcyl &lt;2— as . factor I: mtcara2\$cylj Now, the mtccrsﬂ 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 + ﬁwjﬁw-ﬁ + 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 ﬁtted value of mpg at weight = 3, cylinder = 6. [1 pt) [13) At a: = 0.05, test that Ho : 16mg = (15&quot;,ng = 0 vs H1 : At least one of ﬂay“; and ﬁcygg is nonzero. [1 pt) Suppose we wonder if there is a signiﬁcant interaction between the weight and cylinder predictors. Now considera larger model Y&quot; = 30 + Jam-Tu + lacyis‘wii + Jacyiswﬂ + tautqsaﬁn’wn + ﬁwezcytsﬁﬂwﬂ + Ei- Answer (‘3) and (‘1)using this model. {c} lUbtain the ﬁtted value of mpg at weight = 3, cylinder = 8. [1 pt) (:1) At a = 0.05, test that H0 : ﬁwt5cylﬁ = ﬁrstqﬂg = D vs H1 : At least one of ﬁwtwm and ﬁwtwm is nonzero.(1 Pt)