I am trying to build a GLMM and have converted a group of factors to dummy variables. Many have multiple groups and I would like to test the interactions between them as well. Do I need a reference group? How would I be able to test the interactions between them if I do?
-
1$\begingroup$ What do you mean by non-mutually exclusive groups. You have to have mutually exclusive groups if you want to do inference. Otherwise, how would you attribute effects to one group over another? $\endgroup$– StatsStudentCommented May 3, 2019 at 22:16
-
$\begingroup$ For example, if a predictor variable is type of pet. You can have a dummy column for cats another for dogs another for fish. However, some may have a cat and a dog or perhaps all three. If you have for example cat as a reference and only a column for dog and fish than how can you get the interaction between dog and cat? $\endgroup$– JValCommented May 3, 2019 at 22:33
-
4$\begingroup$ In that case, the easiest thing to do is to simply create a separate dummy variable for each "group." So you will create a variable called "HasCat" which will be coded 1 if the person has a cat, and 0 if not. Then you'll create another variable called "HasDog" that will be coded 1 if the person has a dog and 0 if not. Finally, you'll create a variable called "HasFish" which is coded as 1 if the person has a fish and 0 otherwise. A person who has a cat, a dog, and a fish, will have 1's in all the variables. A person who has only a dog and a cat will have two 1's and one zero. $\endgroup$– StatsStudentCommented May 3, 2019 at 22:47
-
$\begingroup$ Also, you'll test for interactions as you normally would by multiplying together the HasDog, HasCat, and HasFish categories as appropriate. $\endgroup$– StatsStudentCommented May 3, 2019 at 22:52
-
$\begingroup$ Yes, that is what I thought. I just read that you always need to include a reference variable, but I wanted to make sure that you can do it this way when they are not mutually exclusive. $\endgroup$– JValCommented May 4, 2019 at 3:57
1 Answer
You must have a reference group to create dummy variables from factors anyway, so you are already halfway there. For instance, if education is coded as less-than-high-school, high school or equivalent, or some college, 2 dummy variables are required to summarize the difference from the reference level. Suppose further you also measure residency with 3 levels (2 dummies) , homeless/occupy without payment, rent, or own. Therefore there are 4 variables (dummy) in the "marginal model": the 2 for education, and the 2 for residence.
One way to calculate the "interaction" effect is to take the product of all possible dummies. This leads to $2 \times 2 = 4$ extra variables for a total of 8 in the model. The "single level" dummies
Education:
- Less Than High School vs High School
- Some College vs High School
Residence:
- Homeless/Occupy vs Rent
- Own vs Rent
As well as all the product level:
- Less than High School vs High School $\times$ Homeless/Occupy vs Rent
- Some College vs High School $\times$ Homeless/Occupy vs Rent
- Less than High School vs High School $\times$ Own vs Rent
- Some College vs High School $\times$ Own vs Rent
To test the significance you have to use a 4 degree of freedom test for the mutual significance of all 4 product terms. This quickly becomes an underpowered test. Interactions are sometimes tested at the 0.1 level because of the tremendous amount of power needed to detect them in moderate to small sample sizes.
There is an interesting alternative to consider in this case. Note each regressor is quasi-continuous. One could code education as 0 for less than high school, 1 for highschool, and 2 for some college. Similarly for residence. You can continue to adjust for the marginal or single-level effects as categorical factors, but adjust for one continuous interaction term using the numeric levels to improve power. It is an interesting fact that the models are indeed nested and the test can be a consistent and powerful alternative to the product-dummy adjustment I describe above.