Contents
How do you read an interaction plot?
Use an interaction plot to show how the relationship between one categorical factor and a continuous response depends on the value of the second categorical factor. This plot displays means for the levels of one factor on the x-axis and a separate line for each level of another factor.
What is a categorical variable in R?
In descriptive statistics for categorical variables in R, the value is limited and usually based on a particular finite group. For example, a categorical variable in R can be countries, year, gender, occupation. A continuous variable, however, can take any values, from integer to decimal.
How to plot the interaction of categorical factors?
In this example, we will visualize the interaction between categorical factors. First, we will create some categorical data. Then, we will plot it using the interaction_plot function, which internally re-codes the x-factor categories to integers.
How does a factorial plot show the relationship between two factors?
Use an interaction plot to show how the relationship between one categorical factor and a continuous response depends on the value of the second categorical factor. This plot displays means for the levels of one factor on the x-axis and a separate line for each level of another factor.
How to analyze the effect of categorical variables?
A common method for analyzing the effect of categorical variables on a continuous response variable is the Analysis of Variance, or ANOVA. In R we can do this with the aov function. Once again we employ the formula notation to specify the model.
Can you interpret the main effects of an interaction plot?
Although 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. If the interaction effects are significant, you cannot interpret the main effects without considering the interaction effects. In this interaction plot, the lines are not parallel.