Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • SEM*interaction operators not allowed

    Greetings! I am hoping to use interactions in a linear SEM and have an error message.


    Code:
    sysuse auto
    sem (mpg <- turn trunk price) (trunk <- length)
    works fine, but

    Code:
    sem (mpg <- turn c.trunk##c.price) (trunk <- length)
    sem (mpg <- turn trunk price c.trunk#c.price) (trunk <- length)
    both return an error: interaction operators not allowed r(101);

    There is a workaround:

    Code:
    gen trpr = trunk*price
    sem (mpg <- turn trunk price trpr) (trunk <- length)

    However, I'm wondering why this is so and if there's any way to use the Stata trunk#price coding. Thank you!

  • #2
    Administrative bump, post was flagged as spam.

    Comment


    • #3
      No, for whatever reason, -sem- does not support factor variable notation. But -gsem- does and it can estimate the same models that -sem- does (and more).

      Comment


      • #4
        The initial post lets me believe that Brian wants direct and indirect effects (probably moderated). This is not automated within the gsem framework. Whether sem gets it right with the interaction term added manually, I cannot tell.

        Best
        Daniel

        Comment


        • #5
          Thanks to you both. I will investigate the gsem option. Yes, I am hoping to estimate direct and indirect effects in moderated mediation. It's straightforward in Mplus but I was hoping to "stay home" in Stata to do it.

          Comment

          Working...
          X