There are multiple plots to visualize the information coming out of a well designed experiment. These can show simply one of the output variables but it is possible and often necessary to go much further to see how variables relate to each other and how solid the design finally is.
There are several packages in R to establish 3D plots although they may be generic such as {plot3D}
or related with cartography such as {rayshader}
. In the domain of the design of experiments the {rsm}
package brings some specific advantages such as building the surface plots directly from the design models.
In this exercise we’re then going to prepare the model for out surface plot. We’re going to use the battery_charging dataset of which we’re showing below the first 5 lines:
Use all the 4 entry variables to establish a linear model of the charging time:
battery_lm <- lm(
)
summary(battery_lm)
# An lm function takes a dataset and a formula expressed with ~
# Checking ?lm and ?formula gives many details of the syntax
# The adjusted R-squared of the full model it should be 0.3832 (not great)
Surface response plots give a clear idea of what the interaction plots are: in the interaction plots we see the front and back edges of the surface, when the input factor is either at its min or at its max. If the lines cross each other we can see its because the surface is bent. In this case we say there is an interaction and the p value on the interaction term goes beyond 0.05.
Check out this situation with the inputs A and C, what is the interaction p value? What about A-B and BC?
As we could see several terms and interactions are non significative so a model with a better adjustment to the date can be prepared by removing them. This should in principle even improve the adjusted R-square. What is the adjusted R-square for a model with just the C factor and its interaction with A?
battery_reduced_lm <- lm(
)
summary(battery_reduced_lm)
# An lm function takes a dataset and a formula expressed with ~
# Checking ?lm and ?formula gives many details of the syntax
# The adjusted R-squared of the full model it should be 0.455 (still not great...)
We end this tutorial with a slightly advanced topic, still recurrent in design of experiments and important to decide which factors to take into account: to choose between different models and select which factors to keep the Adjusted R2 is more appropriate than the Multiple R-squared.
There’s a good wikipedia article on the topic: adjusted R-squared