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 dofit 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_typespeed ~ car_type + car_store + car_type :car_store , random=~1|car_owner
data = data1, data=data1random = ~ 1 | car_owner, method="ML"method = "ML")
lme4 equivalent is :
m2 <- lmer(speed~car_type*car_store+speed ~ car_type * car_store + (1|car_owner1 | car_owner), data=data1
data = data1, REML =F= FALSE)
Now, my question is, I can I have interaction as the main effect in nlme like this:
m3 <- lme(speed~car_typespeed +~ car_type + car_type:car_store , random=~1|car_ownerdata = data1, data=data1
random = ~ 1 | car_owner, method="ML"method = "ML")
So far, I cantcan't find the equivalent of m3m3
in lme4, can. Can anyone help me to understand why?
Also, ideally, I think I can achieve my purpose with m3m3
. 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?
Thanks.