Can I use interaction terms with psem in piecewiseSEM?

Viewed 178

I am trying to use interaction terms with psem in the piecewiseSEM package but I get the following error:

Error in names(B) <- numVars : 'names' attribute [3] must be the same length as the vector [2]

 lme(response1 ~ predictor1 * predictor2, data),
 lme(response2 ~ predictor1 * predictor2, data),
  ...)```

lme is in the nlme package

predictor1 is an integer of 7 levels
predictor2 is a factor of 2 levels

The model alone runs fine outside of psem, though. I could not find a reference as to why interaction terms will not work in the function psem.

I appreciate any insights on this. Thanks!

1 Answers

Update:

this SEM only worked if predictor2 is an integer

Related