Let's say I am trying to see if there are speed differences among different types of cars (e.g., jeep, SUV, truck, sports car). I also want to see whether the car store (A, B, C, D, E) has an effect on this. I don't have a specific hypothesis about the car stores, but I assume that certain stores tend to sell certain types of cars (e.g., SUVs at Store A and trucks at Store B).
So, I tried to fit a linear mixed effect model with lme4 and nlme. I have a question about the difference between these two models:
nlme:
m1 <- lme(speed ~ car_type + car_store + car_type:car_store,
data = data1, random = ~ 1 | car_owner, method = "ML")
lme4 equivalent is:
m2 <- lmer(speed ~ car_type * car_store + (1 | car_owner),
data = data1, REML = FALSE)
Now, my question is, can I have interaction as the main effect in nlme like this:
m3 <- lme(speed ~ car_type + car_type:car_store, data = data1,
random = ~ 1 | car_owner, method = "ML")
So far, I can't find the equivalent of m3
in lme4. Can anyone help me understand why?
Also, ideally, I think I can achieve my purpose with m3
. But is there anything else that I should consider? like perhaps it's better to use lme4 and car_store as main/fixed effect as well?
lmer()
for the fixed effects will be the same as inlme()
, e.g.,lmer(speed ~ car_type + car_type:car_store + (1 | car_owner), data = data1)
. $\endgroup$