How to run a sensitivity analysis to find out significant interaction terms in R?

Viewed 116

I have a longitudinal dataset and I ran several linear mixed effect models. I got main effect model

lme1 <- lme(Y~A+B+C+D+Time, random = TIME | ID, data)

How do I find out significant interaction terms of predictors * Time?

Do I manually plug in each predictor*Time like

lme2 <- lme(Y~A+B+C+D+Time+A* Time+B* Time+C* Time+D* Time, random = TIME|ID, data)

Or is there a better way to find significant interaction terms in linear mixed effect model?

1 Answers

Yes but there is a faster way:

lme((Y~A+B+C+D+Time)^2, random = TIME | ID, data)

The R formula syntax using ^2 means "all two-way interactions of the variables inside enclosing parentheses".

lme((Y~A+B+C+D+Time)*Time, random = TIME | ID, data)

When you only want interactions with time

Related