最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to run a structural equation modeling in Stata with a panel data set using fixed effects? - Stack Overflow

programmeradmin1浏览0评论

I'm trying to run a SEM model in Stata for a panel data set (that you can download here). I would like to use this information to understand the indirect and direct effects in this model, by using M1 and M2 variables as mediation variables, the IV, CV1, CV2, and CV3 as independent variables, and the "DV" as dependent variable. Since it is a panel data, I would like to account for unit (id_dum) and time (year_dum) fixed effects. I have tried so many things without success.

use "...\PanelData.dta", clear 
    
    xtset id timevar, delta(1)

    qui tabulate id, generate(id_dum)
    qui tabulate timevar, generate(year_dum)

My 1st try was with the sem command, which works perfect. But it doesn't include the unit and time fixed effects:

 sem (DV <- MV1 MV2 IV  CV*, )  ///
                         (MV1 <- IV  CV*, )  ///
                         (MV2 <- IV  CV*, ), ///
                         vce(robust) nocapslatent

Therefore, my 2nd try was including unit and time fixed effects. But I got an error message related to the fitting model:

sem (DV <- MV1 MV2 IV CV* id_dum* year_dum*, )  ///
            (MV1 <- IV CV* id_dum* year_dum*, )  ///
            (MV2 <- IV CV* id_dum* year_dum*, ), ///
            vce(robust) nocapslatent
Fitting target model:
        __sem_d2L_dth2():  3900  unable to allocate real <tmp>[111155,111155]
     _sem_eval_ml_d2_g():     -  function returned error
        __sem_d2L_dth2():  3900  out of memory
     _sem_eval_ml_d2_g():     -  function returned error
       _sem_eval_ml_d2():     -  function returned error
      opt__calluser1_d():     -  function returned error
       opt__eval_nr_d2():     -  function returned error
             opt__eval():     -  function returned error
opt__looputil_iter0_common():     -  function returned error
opt__looputil_iter0_nr():     -  function returned error
          opt__loop_nr():     -  function returned error
             opt__loop():     -  function returned error
             _optimize():     -  function returned error
              _sem_fit():     -  function returned error
            st_sem_fit():     -  function returned error
                 <istmt>:     -  function returned error

My 3rd try was using the xtdpdml command, but I got an error saying there is an invalid name:

xtdpdml (MV1 <- IV CV* id_dum* year_dum*) (MV2 <- IV CV* id_dum* year_dum*) (DV <- MV1 MV2 IV CV* id_dum* year_dum*), ///
    lags(0) /// 
    iv(IV CV1 CV2 CV3) /// 
    fe /// 
    twostep ///
    robust 
    
< invalid name
r(198);

Does anyone know how to properly code a SEM model (that considers a mediation variable) with unit and time fixed effects in Stata? Any help is appreciated!

发布评论

评论列表(0)

  1. 暂无评论