Flexibly modeling the relationship between factors and a response.
We’ve really pushed a particular recipe for all our hypothesis testing approaches,
We’re now going to introduce a quite different approach based on response surfaces. The idea is simple: use a flexible (nonlinear) function from experimental inputs (combinations of factor levels) to the response of interest. This will work as long as the response varies smoothly as factor inputs are perturbed. The estimated function will be a good representation of how varying the factors affects the response.
Moreover, if we have successfully estimated this function, then we’ll be able to use the fit to (a) determine important influences and (b) find configurations that optimize the response (e.g., maximize profit[^Or if you are disgruntled, minimize profit]).
How should we fit these flexible functions?
Material
and a quadratic expansion of Temperature
.To visualize the response surface, we compute predictions across a find grid of temperature values for each material.
surface <- expand.grid(
Temperature = seq(15, 125, by = 1),
Material = unique(battery$Material)
)
surface$Life <- predict(fit, surface)
ggplot(battery, aes(Temperature, Life)) +
geom_point() +
geom_line(data = surface) +
facet_wrap(~ Material)
summary(fit)
Call:
lm(formula = Life ~ Material * poly(Temperature, 2), data = battery)
Residuals:
Min 1Q Median 3Q Max
-60.750 -14.625 1.375 17.937 45.250
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 83.167 7.501 11.087 1.48e-11
Material2 25.167 10.608 2.372 0.025059
Material3 41.917 10.608 3.951 0.000503
poly(Temperature, 2)1 -189.223 45.007 -4.204 0.000257
poly(Temperature, 2)2 109.955 45.007 2.443 0.021385
Material2:poly(Temperature, 2)1 -71.035 63.650 -1.116 0.274242
Material3:poly(Temperature, 2)1 45.928 63.650 0.722 0.476759
Material2:poly(Temperature, 2)2 -158.392 63.650 -2.488 0.019293
Material3:poly(Temperature, 2)2 -197.636 63.650 -3.105 0.004434
(Intercept) ***
Material2 *
Material3 ***
poly(Temperature, 2)1 ***
poly(Temperature, 2)2 *
Material2:poly(Temperature, 2)1
Material3:poly(Temperature, 2)1
Material2:poly(Temperature, 2)2 *
Material3:poly(Temperature, 2)2 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 25.98 on 27 degrees of freedom
Multiple R-squared: 0.7652, Adjusted R-squared: 0.6956
F-statistic: 11 on 8 and 27 DF, p-value: 9.426e-07