2

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!

user3508884
  • 75
  • 1
  • 1
  • 8

1 Answers1

1

Update:

this SEM only worked if predictor2 is an integer

user3508884
  • 75
  • 1
  • 1
  • 8
  • I was having this issue with my dummy variables. The solution that I think makes sense was to leave one of them out. – canderson156 Mar 16 '22 at 18:25