solve all parts since this is only 1 question.
![Question 3 [27 marks]. A company wants to predict sales as a function of various other quantities including advertising spend](https://media.cheggcdn.com/study/663/66305981-7d4d-4d10-bc55-c7ae72a7a74f/image)
Question 3 [27 marks]. A company wants to predict sales as a function of various other quantities including advertising spend, and whether it is summer (coded as 1 for summer. 0 for the rest of the year). These are named sales, ad spend, summer in the dataset in R, and the dataset is called sales_data. The following R commands are run: model1 = 1 m (sales ad spend+summer, data=sales_data) summary (model1) Part of the output is: Coefficients : (a) What are the interpretations of the coefficients for ad spend and summer? (b) From this model, do sales appear to be significantly related to advertising spend? (c) If the following R command is run: predict (model1, newdata=data, frame (ad spend =200, summer=1)) what will the numerical output be? What is the interpretation of this quantity? (d) The following R commands are run to produce the plot below: plot ( x modeli\$fitted, values, y= model1\$residuals) abline (h=0) Which assumptions of the model appear not to hold here?
Consider now the following R code: n= nrow (sales_data) pr= vector (length=n) for (i in 1:n){ modeli =1 m( sales ad_spend + summer, sales_data [?1], \}pr[i]= predict (modeli, newdata=sales_data [i], r=sales data $ sales - pr S=sum(r?2) (e) What is the name for the statistical procedure that the code is carrying out? (f) Explain what each of the two lines of code inside the loop is doing. (g) When the code has run, what will x contain? What will S contain? [3] (h) What aspect of the model is this method trying to assess? [3] (i) How would the method compare two or more models fitted to the same dataset? [2]