Announcement

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

  • SEM with interaction and using FIML for missing data

    Hi,

    I am using STATA 14 and have a continuous outcome Y, binary variable X1 and binary variable X2. I want to do a simple linear regression like this:

    "regress Y X1 X2 X1#X2"

    However, there is some missing data in the outcome variable Y and I want to use FIML to deal with that. I tried

    "sem Y <- X1 X2 X1#X2, method(mlmv)" and it says interaction is not allowed. Then I tried gsem but the "method" option is not allowed.

    Does anyone know how to solve the problem? To summarize, I would like to run regression with interaction, and use FIML to deal with the missing data.

    Thanks!

  • #2
    Code:
    gen X1X2= X1*X2
    sem Y <- X1 X2 X1X2, method(mlmv)

    Comment


    • #3
      Thanks Andrew! This works perfectly but I got another question. Actually my data has longitudinal characteristics so it looks like the following:

      ID score(Y) time(X1) group(X2)
      1 8 1 0
      1 10 2 0
      2 5 1 0
      2 7 2 0
      3 9 1 1
      3 14 2 1
      ...
      Each ID has 2 observations at 2 different time points.It is a repeated measurement and the score at time 2 will be affected by time 1. I am wondering if there is a way to reflect this in the codes? Thanks!

      Comment


      • #4
        You then want to check whether you should pool the data versus specifying a separate intercept for each group. So xtset your data, run xtreg, fe and check the significance of the F-test at the foot of the table. Eventually, you should cluster your standard errors at the group level to account for the fact that observations of a particular group are not independent.
        Last edited by Andrew Musau; 12 Mar 2020, 15:59.

        Comment

        Working...
        X