Notice you can use it with either aov or lm objects. Using the effects package we can create a formal interaction plot with standard error bars to indicate the uncertainty in our estimates. The only reason to use aov is to create an aov object for use with functions such as model.tables. Lm and aov both give the same results but show different summaries. If we look at the interaction plot again, we see that trt=”yes” and gender=”female” has about the same mean response as trt=”no” and gender=”male”. What does -10 mean exactly? In some sense, at least in this example, it basically offsets the main effects of gender and trt. Because of this it’s difficult to interpret the coefficient for the interaction. For those settings, we add all the coefficients together to get the mean response for gender=”female” when trt=”yes”. The remaining combination to estimate is gender=”female” and trt=”yes”. Likewise, The coefficient for “trtyes” is what you add to the intercept to get the mean response for trt=”yes” when gender=”male”. (Compare it to the model.tables output above.) The coefficient for “genderfemale” is what you add to the intercept to get the mean response for gender=”female” when trt=”no”.
The intercept in the linear model output is simply the mean response for gender=”male” and trt=”no”. If we want a test for the significance of main effects, we can use anova(lm1), which outputs the same anova table that aov created. Nor does it mean the main effects are significant. It does not contradict the ANOVA results. This just means the coefficients are significantly different from 0. (Incidentally we can get these same coefficients from the aov1 object by using coef(aov1).) Notice everything is “significant”. # Residual standard error: 0.9111 on 36 degrees of freedom Finally we combine our vectors into a data frame. Notice we create an interaction by sampling from the distributions in a different order for each gender. Next we generate the response by randomly sampling from two different normal distributions, one with mean 15 and the other with mean 10. Then it generates treatment labels, 10 each of “yes” and “no”, alternating twice so we have 10 treated and 10 untreated for each gender.
INTERACTION PLOT MINITAB CODE
The following code first generates a vector of gender labels, 20 each of “male” and “female”. Using R, we can simulate data such as this. If the response to treatment depends on gender, then we have an interaction. Let’s say we have gender (male and female), treatment (yes or no), and a continuous response measure. The simplest type of interaction is the interaction between two two-level categorical variables. This means variables combine or interact to affect the response. If it does then we have what is called an “interaction”. The general linear model results indicate that the interaction between SinterTime and MetalType is significant.When doing linear modeling or ANOVA it’s useful to examine whether or not the effect of one variable depends on the level of one or more variables. However, if you use MetalType 1, SinterTime 100 is associated with the highest mean strength. For example, if you use MetalType 2, SinterTime 150 is associated with the highest mean strength.
This interaction effect indicates that the relationship between metal type and strength depends on the value of sinter time. In this interaction plot, the lines are not parallel. If the interaction effects are significant, you cannot interpret the main effects without considering the interaction effects. The more nonparallel the lines are, the greater the strength of the interaction.Īlthough you can use this plot to display the effects, be sure to perform the appropriate ANOVA test and evaluate the statistical significance of the effects. Evaluate the lines to understand how the interactions affect the relationship between the factors and the response.