3. This problem uses the data set cakes from the alr4 package, which contains th
ID: 3360513 • Letter: 3
Question
3. This problem uses the data set cakes from the alr4 package, which contains the results of a baking experiment on n 14 packaged cake mixes. The variables X1 and X2 data are the predictors representing baking time in minutes and baking temperature in degrees Fahrenheit, respectively. The response Y is a palatability score indicating quality of the cake. (a) Fit the model and verify that the significance levels for the quadratic terms and the interaction are all less than 0.005. It is possible that the response might differ by block, due to differences in air temperature or humidity, for example. Add a main effect for the Block variable to model in part a), fit the model, and summarize results.Explanation / Answer
# Just read the following code for answer. You can also just run all of these in R script
#just select all these and paste in you R script and run
# In order to solve this problem you will have to install package "alr4" in your system and load the data set teengamb to do so use
install.packages("alr4")
library(alr4)
attach(cakes)
# Now to see overall structure of data run
head(cakes)
X1_sq=(X1*X1) #create quadratic term for X1
X2_sq=(X2*X2) #create quadratic term for X2
X1_X2=(X1*X2) ##create interaction term for X1 and X2
model1=lm(Y~X1+X2+X1_sq+X2_sq+X1_X2) #Fits suggested model
summary(model1)
#summary of the model which suggests that quadratic and interaction terms significance level is less that .005
model2=lm(Y~X1+X2+X1_sq+X2_sq+X1_X2+block) #Fits suggested model after adding bock's effect
summary(model2)
#Summary of model 2 suggests that block variable is not significant
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.