Worksheets/Week2
Revision as of 08:13, 26 September 2019 by Kevin Dunn (talk | contribs)
A baked food product:
- T = time used to bake the product
- F = quantity of fat added
# T = time used for baking: (-1) corresponds to 80 minutes and (+1) corresponds to 100 minutes
A <- c(-1, +1, -1, +1)
# F = quantity of fat used: (-1) corresponds to 20 g and (+1) corresponds to 30 grams
B <- c(-1, -1, +1, +1)
# Response y is the crispiness
y <- c(37, 57, 49, 53)
# Fit a linear model
model_crispy <- lm(y ~ A + B + A*B)
summary(model_crispy)
# Uncomment this line if you run the code in RStudio
#library(pid)
# Comment this line if you run this code in RStudio
source('https://yint.org/contourPlot.R')
# See how the two factors affect the response:
contourPlot(model_crispy )
interaction.plot(T, F, y)
interaction.plot(F, T, y)