Announcement

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

  • Multiple regression with interaction terms using sem command, handing missing data with mlmv, problem with using margins command

    Hello,

    I am using Stata 18 to run multiple regression analyses using the sem command, and applied method(mlmv) to handle missing data (data missing completely at random). Excep cov1, all variables are continuous. iv1, iv2, iv3 and m are mean-centered. And I generated the interaction terms (iv1*m iv2*m iv3*m) because the sem command does not allow factor notation. The sample size is 204.


    Code:
    Code:
    sem (dv <- cov1 cov2 cov3 cov4 iv1 iv2 iv3 m iv1*m iv2*m iv3*m), method(mlmv) nocapslatent
    The results show that the interaction term iv1*m was significant, so I proceeded with simple slope analysis, using the 'margins' command with 'dydx' option to obtain simple slopes of IV on DV at three points (representing a low score, a medium score, and a high score) along the moderator.

    Code:
    margins, dydx(iv) at(m=(-.66 0 .66))
    -.66 0 and .66 represent value of the moderator at mean, 1SD below and above the mean.

    It turns out the output provides estimates based on a smaller sample without missing values (N = 165), and the dydx estimates are exactly the same for all three points of the moderator, which sounds strange if there is an interaction effect.
    I tried the same margins code if I use the 'reg' command instead of the 'sem' command with mlmv, (on the smaller sample without missing values) and the output makes so much sense. I can generate the margins plot with 3 lines of different slopes to illustrate the interaction effect.

    Grateful if someone may point out the issue with the code and suggest a solution for the situation. Thank you in advance.

  • #2
    Because -sem- does not support factor-variable notation for interaction terms, -margins- gives incorrect results. The problem is that -margins- has no way of knowing that iv1*m is an interaction between iv1 and m. So it just things iv1 and iv1*m and m are three variables that have no connection with each other. That's why you get the same results for all three values of m. Moreover, while -sem, method(mlmv)- is able to include observations with missing values, -margins- has no such capability. -margins- is required to calculate predicted outcomes for each observation, and if an observation has a missing value for one of the right hand side variables, it is not possible to do that. So those observations are excluded from -margins- calculations.

    You are facing a dilemma here. To properly handle interactions, you need -margins- and that entails using -factor variable notation-, but -sem- doesn't support factor-variable interactions. -gsem- is the program that can do those things, but it does not have a FIML estimator. So you can't get everything you are looking for this way.

    Perhaps somebody knows a way out of your dilemma in Stata, but I don't. I suspect that to do this you will have to go to some other software. My guess is that MPlus can do all of this. I haven't used it in a long time, so I'm not sure whether it has a -margins-like command, but it is probably the most full-featured SEM program out there.

    Comment


    • #3
      Since the OP is using SEM for doing OLS, they can use Stata's mi suite of commands to impute missing values for predictors and outcomes. Then run the model on the imputed data (mi: reg dv cov1...). The excellent mimrgns by daniel klein, downloadable from SSC, can then help with running and graphing the interaction. Btw, Mplus does not have marginal effects-like capability.

      Comment

      Working...
      X