Announcement

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

  • Medeff command with panel data

    Hello,

    I would like to know if the medeff command is taking into account the 'panel data characteristic' of the dataset? I assumed that preparing the dataset to panel data (with tsset / xtset) in stata was sufficient to run the (normal) medeff command and retrieve the results. Subsequently, that Stata 'reads' the dataset as panel data when performing the medeff command. I am not that familliar with Stata so therefore I am not entirely sure that what I am doing is correct. I hope someone has experience in using the medeff command on longitudinal data, since I am quite stuck with my analysis at the moment. Moreover, if there are other methods of analyzing a mediation effect on longitudinal data. Thanks in advance!!

    Best,

    Quint Koevoets

  • #2
    Why not specify the model directly with the sem or gsem commands? If you are using Latent variables, there is a bit more to it than fitting the structural model (e.g., testing for measurement invariance). Within the sem/gsem framework you likely would have more flexibility for fitting different types of mediation models (e.g., different autoregressive, crosslagged, and/or models with several mediating effects).

    Comment


    • #3
      Thank you for your answer. I have used the sem command but it seems that it does not take into account the longitudinal aspect of my dataset. I am investigating if the relationship is mediated with a dataset comprising of 100 companies, 3 years of data per company. Both with medeff and sem, I have received results but stata seems to not take into account the longitudinal aspect.
      Would this be another option maybe? --> ml_mediation (multi level mediation)
      http://www.ats.ucla.edu/stat/stata/faq/ml_mediation.htm

      Moreover, maybe I misunderstood your answer but are the sem and medeff commands usable with longitudinal data, or is this not possible? Is is possible for with the multilevel mediation or is this something different? According to the answer on this website it is: http://www.researchgate.net/post/Doe...gitudinal_data however, I do not know how reliable this is.

      By the way, for h2 and h3 I am investigating if path a (relationship between IV and MV) is influenced (moderated) by the type of industry of my companies. Therefore. I would like to estimate a mediation model for the group of companies with industry for which I expect a stronger relationship. And a mediation model for the other group of companies. I would like to compare the results of these 2 mediation models, moreover if they statistically differ when the confidence interval of model a is not overlapping with the confidence interval of b.

      Your answers are greatly appreciated!


      Comment


      • #4
        Quint Koevoets You can account for the longitudinal structure using -gsem- by including additional levels in the data. However, a more traditional approach in the SEM literature is to restructure the data and treat the points in time as a multivariate outcome. So I'm assuming your data looks something like:

        Code:
        // Clear existing data from memory
        clear
        
        // Set random number seed
        set seed 7779311
        
        // Set number of firms/students, etc...
        set obs 10
        
        // Create unique IDs for each of the units of measurement
        g id = _n
        
        // Create 5 time points for each unit of measurement
        expandcl 5, cl(id) gen(time)
        
        // Set the time variable to be integers starting from 1
        bys id: replace time = _n
        
        // Generate a variable for random error
        qui: g double err = runiform()
        
        // Create an IV
        qui: g double x = rnormal(0, 1)
        
        // Create a mediator that includes random error, its own effect, and x
        qui: g double z = x + (0.5*rnormal(0, 1)) + runiform()
        
        // Define the outcome
        qui: g double y = 1 + 0.25*time + 2.1*x + 1.57*z + err
        Which results in data that looks something like:
        Code:
        // Generate example data set
        dataex *
        
        // Clear data from memory
        clear
        
        // Input the example data
        input double id byte time double(err x z y)
         1 1   .8471579191957456  1.1593267910224523  1.4627871706446025    6.828320038254922
         1 2  .43188177578500786  -.5806839215197437    -.55941680582215  -.16583884454722952
         1 3    .677597829302406  -.2026592921184106   -.319827257044142   1.4998845222944408
         1 4  .29620384146891354  -.7198663354469061  .11049935935354471    .9579685312154759
         1 5   .8661389625421422   .1485152038044467   .8574234379702236    4.774175688144731
         2 1    .450415259090989  .37543142775909505    .306264733792913    2.969656889439962
         2 2  .42010540354921344   .7826157130611803  2.3482033014350585    7.250277584230734
         2 3  .20276659810744235   .6108082528267048  2.0792586878165626    6.499900068915526
         2 4  .47028037873586326 -.08303136606173002   .3845056173277958   2.8995883292108697
         2 5   .6851241540786327   .4525359044576816   .5479985274260357     4.74580724149864
         3 1   .6463055276039108  .05050905234327961  1.3126347522904687    4.063211098620834
         3 2  .04324413956738671  -.8653401511244383  -.7183832645363459  -1.4018319031159967
         3 3   .7915001208097724  -.8754480631200006  .17502853037408983    .9778539809450921
         3 4   .7956852633665313  -.6350175745487721  .08536851209005292    1.596176920795493
         3 5 .041116772729815065  .23651851005993488  1.3881436556799969    4.967191183273274
         4 1  .33399609240500283   .6290434095313421    .573547927945713   3.8054574992955907
         4 2   .7162050492713569   1.576070079153839  2.0758451019636004    8.785029025577272
         4 3    .703676651760737   -.959971483425633 .030014481105347324    .4848592719023031
         4 4  .06270073332341142  -.9256711565214786 -1.4321728225749997   -2.129720026814443
         4 5  .01523425593505301 -1.7276596165768925  -.4878266365072844   -2.128738758192858
         5 1   .0979045418314971  -.5117175124853142 -.18911979966031944 -.023620319854364247
         5 2   .5413640687235345    .634908333873235  1.2420221603665742    5.324646361632849
         5 3  .06774706718064027    1.03735317689278  2.0380901478679117      7.1959902708081
         5 4   .3162866245729844  -.7631626255509197  .34297025547944837   1.2521084120187869
         5 5    .943347618830965 -1.3229011638404724   -.961796628540316  -1.0947655320423237
         6 1  .07116976815552867  -.3461130827049864   .8109299910438866   1.8674923804139594
         6 2   .3573593696056313 -1.0532775231324327  -1.395451330945301     -2.5453820185566
         6 3   .7507414443171277   .7921363321665417   .4622829359482743    4.890011951305656
         6 4  .19734171976699233 -1.0598185669221138 -.38216923652275303   -.6282829721101689
         6 5   .2432230690003726  1.3573721468886697  1.8024252433094612    8.173512209462432
         7 1   .7086857760373356   .4940631655712854   .9249432761537442    4.448379367298413
         7 2   .4478765865198514 -1.7641742173536359 -1.2752228820409868  -3.7589891947271337
         7 3   .6477412011258404  -.9409987741312396 -1.0914735590069107  -1.2919697121906126
         7 4  .16531698034243292   .9735190018791767  1.1239892261154583    5.974369969289974
         7 5   .3177118898309147  .16213138034232447  1.1589508010377874    4.727740546179122
         8 1    .927292545714696 -.10638602421707849  .48770792085402503   2.7195833305996504
         8 2  .03919459396683689  .28977883148460865  .15482145283909474   2.3907998210418935
         8 3  .00934522535696758   2.534043002906165   2.908071703613022    11.64650810613236
         8 4   .4912976231024454  1.3274958157530083  2.0728989187293148    8.533490138588787
         8 5  .31491488078070595  -2.273885246336529  -2.810388742360573   -6.622554462032105
         9 1    .588442134781607  -.7774287987767146  .20283822892764314    .5242976767669061
         9 2   .6882681092293851  1.6287563874663946  2.3686856484012813    9.327492990898827
         9 3  .12300178617105229  -.3081197926022996  .39019893855797694   1.8385625552422469
         9 4  .08498583048242747  1.1819687802495555  1.4273028822677096   6.8079857941667985
         9 5   .8330287176881629  .11124654466216435   .9863634476827645    4.865237074340649
        10 1   .4866902806446437   .5446190118192268 -.38117030390285356   2.2819528283375403
        10 2   .8452961611565005 -.25037029214047934  1.2584722930522614    3.795320047753544
        10 3   .2607129168993231  .25603253552660593  .36700524908631044   3.1245794825707027
        10 4  .31621452808008754 -.36494571512400076 -.27644778819944626    1.115805498846555
        10 5   .9470687751269778   .8646974801321354   1.425669207160818    7.251234138646946
        end
        For SEM, you would want the data structured more like:

        Code:
        // drop the error variable
        drop err
        
        // Reshape the data to a multivariate format
        reshape wide x y z, i(id) j(time)
        Then you can fit as complex a model as you need/want. Here's an example using the data above:

        Code:
        sem (y1 -> y2, ) (z1 -> y1, ) (z1 -> z2, ) (z1 -> y2, ) (x1 -> z1, )         ///   
        (x1 -> x2, ) (x1 -> z2, ) (x2 -> x3, )(x2 -> z2, ) (x2 -> z3, ) (x3 -> x4, ) ///   
        (x3 -> z3, ) (x3 -> z4, ) (x4 -> x5, ) (x4 -> z4, ) (x4 -> z5, ) (x5 -> z5, ) ///   
        (z2 -> z3, ) (z2 -> y2, ) (z2 -> y3, ) (z3 -> z4, ) (z3 -> y3, ) (z3 -> y4, ) ///   
        (z4 -> z5, ) (z4 -> y4, ) (z4 -> y5, ) (z5 -> y5, ) (y2 -> y3, ) (y3 -> y4, ) ///   
        (y4 -> y5, ), nocapslatent
        
        Endogenous variables
        
        Observed:  y1 y2 z1 z2 x2 x3 z3 x4 z4 x5 z5 y3 y4 y5
        
        Exogenous variables
        
        Observed:  x1
        
        Fitting target model:
        
        Iteration 0:   log likelihood = -151.89199  
        Iteration 1:   log likelihood = -151.89199  (backed up)
        
        Structural equation model                       Number of obs     =         10
        Estimation method  = ml
        Log likelihood     = -151.89199
        
        ------------------------------------------------------------------------------
                     |                 OIM
                     |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
        Structural   |
          y1 <-      |
                  z1 |   2.595369   .6582661     3.94   0.000     1.305191    3.885547
               _cons |   1.518071    .520767     2.92   0.004     .4973861    2.538755
          -----------+----------------------------------------------------------------
          y2 <-      |
                  y1 |  -.3511186   .1927944    -1.82   0.069    -.7289886    .0267515
                  z1 |   1.602721   .7716848     2.08   0.038      .090247    3.115196
                  z2 |   3.357687   .2164965    15.51   0.000     2.933362    3.782013
               _cons |   1.205513   .5040005     2.39   0.017     .2176896    2.193335
          -----------+----------------------------------------------------------------
          z1 <-      |
                  x1 |   .3948997   .2920474     1.35   0.176    -.1775028    .9673021
               _cons |   .4914533   .1708241     2.88   0.004     .1566442    .8262625
          -----------+----------------------------------------------------------------
          z2 <-      |
                  z1 |  -.8492009   .2543323    -3.34   0.001    -1.347683   -.3507187
                  x2 |    1.05263   .1287676     8.17   0.000     .8002506     1.30501
                  x1 |   .5125943   .2299418     2.23   0.026     .0619167    .9632719
               _cons |   .8985878   .1809528     4.97   0.000     .5439269    1.253249
          -----------+----------------------------------------------------------------
          x2 <-      |
                  x1 |  -.5503639   .5768309    -0.95   0.340    -1.680932    .5802038
               _cons |   .1230074   .3373995     0.36   0.715    -.5382834    .7842982
          -----------+----------------------------------------------------------------
          x3 <-      |
                  x2 |   .1221316   .3041513     0.40   0.688    -.4739939    .7182572
               _cons |   .1894533   .3276771     0.58   0.563     -.452782    .8316885
          -----------+----------------------------------------------------------------
          z3 <-      |
                  z2 |   .2292348   .2379071     0.96   0.335    -.2370546    .6955241
                  x2 |   .0864505   .3145519     0.27   0.783    -.5300599     .702961
                  x3 |   .9547477   .1302612     7.33   0.000     .6994405    1.210055
               _cons |   .3888281   .1831249     2.12   0.034     .0299099    .7477463
          -----------+----------------------------------------------------------------
          x4 <-      |
                  x3 |    .193327   .2572381     0.75   0.452    -.3108504    .6975044
               _cons |  -.1444198   .2731214    -0.53   0.597     -.679728    .3908883
          -----------+----------------------------------------------------------------
          z4 <-      |
                  x3 |   .2812046   .2237446     1.26   0.209    -.1573267     .719736
                  z3 |  -.0337018   .1962634    -0.17   0.864     -.418371    .3509675
                  x4 |   .8892431   .1352504     6.57   0.000     .6241572    1.154329
               _cons |   .4097712   .1546509     2.65   0.008     .1066611    .7128813
          -----------+----------------------------------------------------------------
          x5 <-      |
                  x4 |  -.3127282    .391516    -0.80   0.424    -1.080085    .4546291
               _cons |  -.2325588   .3442463    -0.68   0.499    -.9072691    .4421515
          -----------+----------------------------------------------------------------
          z5 <-      |
                  x4 |   .4252395   .3030515     1.40   0.161    -.1687306     1.01921
                  z4 |  -.6066043   .2770414    -2.19   0.029    -1.149596    -.063613
                  x5 |   1.097883   .1132832     9.69   0.000     .8758523    1.319914
               _cons |   .8644576   .1772469     4.88   0.000     .5170601    1.211855
          -----------+----------------------------------------------------------------
          y3 <-      |
                  y2 |   .1887329   .2770098     0.68   0.496    -.3541964    .7316622
                  z2 |  -1.193313   .8807624    -1.35   0.175    -2.919576    .5329495
                  z3 |   3.253887   .2178697    14.94   0.000      2.82687    3.680903
               _cons |   1.505238   .4196724     3.59   0.000     .6826957    2.327781
          -----------+----------------------------------------------------------------
          y4 <-      |
                  z3 |   .5562945   .6155825     0.90   0.366    -.6502251    1.762814
                  z4 |   3.493092   .2503665    13.95   0.000     3.002383    3.983801
                  y3 |  -.2647739    .200226    -1.32   0.186    -.6572096    .1276618
               _cons |    2.01504   .3989585     5.05   0.000     1.233096    2.796985
          -----------+----------------------------------------------------------------
          y5 <-      |
                  z4 |   2.366354    1.17217     2.02   0.044     .0689436    4.663765
                  z5 |   3.342311   .2113123    15.82   0.000     2.928147    3.756476
                  y4 |  -.5612937   .3408115    -1.65   0.100    -1.229272    .1066846
               _cons |   2.322731   .5918934     3.92   0.000     1.162642    3.482821
        -------------+----------------------------------------------------------------
            var(e.y1)|   1.395785   .6242142                      .5809647    3.353417
            var(e.y2)|   .5048813   .2257898                      .2101457    1.212993
            var(e.z1)|   .2723268   .1217883                        .11335    .6542735
            var(e.z2)|   .1409064   .0630153                      .0586492     .338532
            var(e.x2)|   1.062382   .4751116                      .4421929    2.552405
            var(e.x3)|   1.072255   .4795271                      .4463024    2.576126
            var(e.z3)|   .1740993   .0778596                       .072465    .4182788
            var(e.x4)|   .7209672   .3224263                      .3000866    1.732146
            var(e.z4)|   .1313853   .0587573                      .0546862    .3156572
            var(e.x5)|   1.167554   .5221459                      .4859683    2.805083
            var(e.z5)|   .1497968   .0669912                      .0623496    .3598914
            var(e.y3)|   .5571938   .2491846                      .2319196    1.338675
            var(e.y4)|   .4624743   .2068248                      .1924947    1.111109
            var(e.y5)|   .6952341   .3109181                      .2893758    1.670321
        ------------------------------------------------------------------------------
        LR test of model vs. saturated: chi2(75)  =   2036.54, Prob > chi2 = 0.0000
        The direct/indirect effects can be decomposed using
        Code:
        estat teffects
        after fitting the model. I've also included a copy of the SEM Builder file and Png showing the model (not very clean but should at least give you an idea).
        Click image for larger version

Name:	mediationExample.png
Views:	1
Size:	338.5 KB
ID:	1318704
        Attached Files

        Comment


        • #5
          wbuchanan Thank you, I have followed your recommendation to restructure the data. Therefore, I have reshaped the dataset to:

          Command:
          reshape wide csrrep csp roa roe rdexpenses, i(idc) j(date)
          (note: j = 2012 2013 2014)

          Data long -> wide
          -----------------------------------------------------------------------------
          Number of obs. 246 -> 106
          Number of variables 8 -> 17
          j variable (3 values) date -> (dropped)
          xij variables:
          csrrep -> csrrep2012 csrrep2013 csrrep2014
          csp -> csp2012 csp2013 csp2014
          roa -> roa2012 roa2013 roa2014
          roe -> roe2012 roe2013 roe2014
          rdexpenses -> rdexpenses2012 rdexpenses2013 rdexpenses2014
          -----------------------------------------------------------------------------

          Then I have the following data:

          Command:
          describe

          Contains data
          obs: 106
          vars: 17
          size: 15,370
          -----------------------------------------------------------------------------------------------------------------------------------------------------------
          storage display value
          variable name type format label variable label
          -----------------------------------------------------------------------------------------------------------------------------------------------------------
          idc float %9.0g group(label)
          csrrep2012 double %10.0g 2012 csrrep
          csp2012 double %10.0g 2012 csp
          roa2012 double %10.0g 2012 roa
          roe2012 double %10.0g 2012 roe
          rdexpenses2012 double %10.0g 2012 rdexpenses
          csrrep2013 double %10.0g 2013 csrrep
          csp2013 double %10.0g 2013 csp
          roa2013 double %10.0g 2013 roa
          roe2013 double %10.0g 2013 roe
          rdexpenses2013 double %10.0g 2013 rdexpenses
          csrrep2014 double %10.0g 2014 csrrep
          csp2014 double %10.0g 2014 csp
          roa2014 double %10.0g 2014 roa
          roe2014 double %10.0g 2014 roe
          rdexpenses2014 double %10.0g 2014 rdexpenses
          label str21 %21s label
          -----------------------------------------------------------------------------------------------------------------------------------------------------------
          Sorted by: idc

          IDC is the indicator. So I have for example company X which is idc 1 and then the variables: csrrep2012, csp2012, roa2012, roe2012, rdexpenses2012, csrrep2013, etc.

          So far I have done everything correct I assume. However when trying to use the sem equation to check for mediation:

          Command:
          . sem (csrrep <- csp rdexpenses)(roa <- csrrep csp rdexpenses)
          csrrep ambiguous abbreviation
          r(111);

          Did not work so I thought maybe this will work:

          Command:
          . sem (csrrep2012 csrrep2013 csrrep2014 <- csp2012 csp2013 csp2014 rdexpenses2012 rdexpenses2013 rdexpenses 2014)(roa2012 roa2013 roa2014 <- csrrep2012 csr
          > rep2013 csrrep2014 csp2012 csp2013 csp2014 rdexpenses2012 rdexpenses2013 rdexpenses 2014)
          rdexpenses ambiguous abbreviation
          r(111);


          Just for the record:
          csrrep = mediator variable
          csp = independent variable
          roa = dependent variable
          rdexpenses = covariate


          I do not know what I have done wrong, since it should be possible to fit any model right? Thank you very much for the help already, this is exactly what I needed!

          Best,


          Quint

          Comment


          • #6
            Code:
            rdexpenses 2014 != rdexpenses2014
            That's where the error is.

            Comment


            • #7
              Thank you, silly that I did not see it.

              I have build this model on basis of the following mediation equation:

              sem (M <- X x)(Y<- M X x) derived from: http://www.ats.ucla.edu/stat/stata/f..._mediation.htm With the new variables that are organized per year I receive a lot of results since it analyzes the results per year. How can I build a model that indicates a result where I can conclude for the direct, total and indirect effect if there is mediation for the three years combined. Because with these results I can conclude if there is a mediation effect per year instead of the effects of 3 years combined right? However, I would like to build a model where I can see the mediating effect of the M on the relationship between X and Y on an analysis of 3 years of company data (x=covariate). The longitudinality of the data is for the reliability of the results. Is that even possible with a mediation analysis with multiple years of data? I have also tried to build the model with (according to your suggestion): sem (roa2012 -> roa2013, ) (csrrep2012 -> roa2012, ) (csrrep2012 -> csrrep2013, ) (csrrep2012 -> roa2013, ) (csp2012 -> csrrep2012, ) (csp2012 -> csp2013, ) (csp2012 -> csrrep2013, ) (csp2013 -> csp2014, )(csp2013 -> csrrep2013, ) (csp2013 -> csrrep2013, ) (csp2014 -> csrrep2014, ) (csrrep2013 -> csrrep2014, ) (csrrep2013 -> roa2013, ) (csrrep2013 -> roa2014, ) (csrrep2014 -> roa2014, ) (roa2013 -> roa2014, ) Best,

              Comment


              • #8
                I thought I repost my message since it was not posted with the right spaces as it should have been, now it is much better readable!

                Thank you, silly that I did not see it.

                I have build this model on basis of the following mediation equation:

                sem (M <- X x)(Y<- M X x) derived from: http://www.ats.ucla.edu/stat/stata/f..._mediation.htm

                With the new variables that are organized per year I receive a lot of results since it analyzes the results per year. How can I build a model that indicates a result where I can conclude for the direct, total and indirect effect if there is mediation for the three years combined. Because with these results I can conclude if there is a mediation effect per year instead of the effects of 3 years combined right?
                However, I would like to build a model where I can see the mediating effect of the M on the relationship between X and Y on an analysis of 3 years of company data (x=covariate). The longitudinality of the data is for the reliability of the results. Is that even possible with a mediation analysis with multiple years of data?

                I have also tried to build the model with (according to your suggestion): sem (roa2012 -> roa2013, ) (csrrep2012 -> roa2012, ) (csrrep2012 -> csrrep2013, ) (csrrep2012 -> roa2013, ) (csp2012 -> csrrep2012, ) (csp2012 -> csp2013, ) (csp2012 -> csrrep2013, ) (csp2013 -> csp2014, )(csp2013 -> csrrep2013, ) (csp2013 -> csrrep2013, ) (csp2014 -> csrrep2014, ) (csrrep2013 -> csrrep2014, ) (csrrep2013 -> roa2013, ) (csrrep2013 -> roa2014, ) (csrrep2014 -> roa2014, ) (roa2013 -> roa2014, )

                Best,

                Comment


                • #9
                  Quint Koevoets With three years of data, you wouldn't have sufficient data to truly identify the mediating relationship. This is an issue of temporal precedence. In other words, before an effect can be mediated, you need to have the effect (year 1), the mediator of the effect (year 2), and the outcome (year 3). Depending on your data it could very well make sense to estimate the mediation effect within years. In terms of a combined effect, this is where you'll need to do a fair amount of post-hoc manipulation to combine the coefficients for the paths of interest. If you have a copy of David MacKinnon's book on mediation you should be able to figure things out from the explication/examples there.

                  Comment


                  • #10
                    wbuchanan Thank you for your message and your clear answer.

                    Unfortunately, I have to generate some results tomorrow for my dissertation otherwise I will not have enough time to finish the remaining parts before the deadline. Basically, I have come at a point where it does not really matter anymore what kind of results I am generating, unless these results are incorrect, when a wrong statistical analysis tool is used for example. As long as the data has been analyzed properly and when the generated results allow drawing correct conclusions, it is okay. Therefore, I would kindly like to ask which approach you would recommend with this data and in my situation.

                    For example, estimating the mediation effect within years, by using the medeff command (or sem) and calculate the mediation effect within years. What would you recommend to do with the values per year? Could the average value of the total accumulated scores representing the effects for three years for example? Or does this imply that 3 models are estimated (1 for each year), which generates 3 answers on the question if the relationship is mediated? Please correct my if I am misinterpreting your suggestion.

                    Another option would be by using the sem command and restructure the data and treat the points in time as a multivariate outcome (although I am not entirely sure how to properly analyze these results).

                    If there are other (simple) options I am interested.

                    Lastly, an approach where I could apply baron & kenny's 4 steps of mediation as well as interpreting the confidence intervals etc. would be highly favorable since this would allow analysis of h2 and h3 as well (where industry characteristics are investigated).

                    I have tried to generate correct results for more than a week now, and I would really like to generate some correct results so I can continue with my conclusion and discussion. I would highly appreciate your recommendation and I am very grateful for your help so far.

                    The best regards,

                    Q

                    p.s. I am able to use a e-copy of the book of McKinnon

                    Last edited by Quint Koevoets; 02 Dec 2015, 14:12.

                    Comment


                    • #11
                      Dear wbuchanan I am very interested in your opinion, please!

                      Comment


                      • #12
                        Originally posted by Quint Koevoets View Post
                        wbuchanan Thank you for your message and your clear answer.

                        Unfortunately, I have to generate some results tomorrow for my dissertation otherwise I will not have enough time to finish the remaining parts before the deadline. Basically, I have come at a point where it does not really matter anymore what kind of results I am generating, unless these results are incorrect, when a wrong statistical analysis tool is used for example. As long as the data has been analyzed properly and when the generated results allow drawing correct conclusions, it is okay. Therefore, I would kindly like to ask which approach you would recommend with this data and in my situation.
                        Quint Koevoets not really sure what to tell you here. Either your committee failed you by not giving you sufficient time for relatively complex analyses, or there is a piloting error in planning out the time required. In either case, waiting until the day prior also does not respect the time of the community members who are generally more than happy/willing to offer advice when possible.

                        Originally posted by Quint Koevoets View Post
                        For example, estimating the mediation effect within years, by using the medeff command (or sem) and calculate the mediation effect within years. What would you recommend to do with the values per year? Could the average value of the total accumulated scores representing the effects for three years for example? Or does this imply that 3 models are estimated (1 for each year), which generates 3 answers on the question if the relationship is mediated? Please correct my if I am misinterpreting your suggestion.

                        Another option would be by using the sem command and restructure the data and treat the points in time as a multivariate outcome (although I am not entirely sure how to properly analyze these results).

                        If there are other (simple) options I am interested.

                        Lastly, an approach where I could apply baron & kenny's 4 steps of mediation as well as interpreting the confidence intervals etc. would be highly favorable since this would allow analysis of h2 and h3 as well (where industry characteristics are investigated).

                        I have tried to generate correct results for more than a week now, and I would really like to generate some correct results so I can continue with my conclusion and discussion. I would highly appreciate your recommendation and I am very grateful for your help so far.

                        The best regards,

                        Q

                        p.s. I am able to use a e-copy of the book of McKinnon
                        If you have access to MacKinnon, D. P. (2008). Introduction to Statistical Mediation Analysis. New York City, NY: Routledge, you should find the information needed to combine the coefficients appropriately to estimate the type of effect you are looking for. If that fails, you should look to Hayes, A. F. (2013). Introduction to Mediation, Moderation, and Conditional Process Analysis: A Regression-Based Approach. New York City, NY: The Guilford Press and Little, T. D. (2013). Longitudinal Structural Equation Modeling. New York City, NY: The Guilford Press. In either case, Baron and Kenny's (1986) 4 step process is known to yield inconsistent estimates (you can find a very brief discussion at http://davidakenny.net/cm/mediate.htm#BK, but should really dig into the literature prior to using the older approach).

                        Comment


                        • #13
                          Many thanks for your response, I highly appreciate this! Unfortunately, my committee/supervisors do not have experience with mediation models in Stata. However, Stata has been recommended by them since it is a powerful tool to analyze mediation effects. I have made mistakes in planning out the time required due to several circumstances as well as that I have spent a lot of time on my dataset, the analysis strategy and Stata. I had not expected that the analysis would be this specialized.

                          However, since I have access to that book I assume you refer to chapter 8 (longitudinal mediation models). I have already studied the book today and it is a quite helpful book. I would like to ask 3 questions. First, I would like to know how I am able to add my covariate/control variable (rdexpenses) to the syntaxis for the model.

                          Second, is the following syn-taxis correct for the model without the control variable?: (Y=dependent, X = independent, M = mediator).

                          sem (Y12 -> Y13, ) (M12 -> Y12, ) (M12 -> M13, ) (M12 -> Y13, ) (X12 -> M12, ) (X12 -> X13, ) (X12 -> M13, ) (X13 -> X14, )(X13 -> M13, ) (X13 -> M13, ) (X14 -> M14, ) (M13 -> M14, ) (M13 -> Y13, ) (M13 -> Y14, ) (M14 -> Y14, ) (Y13 -> Y14, )

                          Subsequently, if this is the correct syntaxis, where would I fit in the covariate x per year for example? In the book it is explained that covariates can be added as far as I remembered.

                          Lastly, I thought Baron and Kenny's 4 step process was among the most used approaches to estimate mediation, it is good to know that this is know to yield inconsistent estimates. Thank you!


                          Comment


                          • #14
                            With SEM I have generated the following results:

                            sem (csp2012 -> csp2013) (csp2012 -> csrrep2012) (csp2012 -> csrrep2013) (csp2013 -> csp2014) (csp2013 -> csrrep2013) (csp2013 -> csrrep2014) (csp2014 ->
                            > csrrep2014) (csrrep2012 -> csrrep2013) (csrrep2012 -> roa2012) (csrrep2012 -> roa2013) (csrrep2013 -> csrrep2014) (csrrep2013 -> roa2013) (csrrep2013 ->
                            > roa2014) (csrrep2014 -> roa2014) (roa2012 -> roa2013) (roa2013 -> roa2014), nocapslatent

                            (47 observations with missing values excluded;
                            specify option 'method(mlmv)' to use all observations)

                            Endogenous variables

                            Observed: csp2013 csrrep2012 csrrep2013 csp2014 csrrep2014 roa2012 roa2013 roa2014

                            Exogenous variables

                            Observed: csp2012

                            Fitting target model:

                            Iteration 0: log likelihood = -1409.5922
                            Iteration 1: log likelihood = -1409.5922

                            Structural equation model Number of obs = 59
                            Estimation method = ml
                            Log likelihood = -1409.5922

                            ---------------------------------------------------------------------------------
                            | OIM
                            | Coef. Std. Err. z P>|z| [95% Conf. Interval]
                            ----------------+----------------------------------------------------------------
                            Structural |
                            csp2013 <- |
                            csp2012 | .8952065 .0538061 16.64 0.000 .7897486 1.000664
                            _cons | 4.812915 2.67275 1.80 0.072 -.4255786 10.05141
                            --------------+----------------------------------------------------------------
                            csrrep2012 <- |
                            csp2012 | .0293492 .0244935 1.20 0.231 -.0186571 .0773555
                            _cons | 66.6809 1.216683 54.81 0.000 64.29625 69.06556
                            --------------+----------------------------------------------------------------
                            csrrep2013 <- |
                            csp2013 | -.0384826 .0226693 -1.70 0.090 -.0829137 .0059485
                            csrrep2012 | .9794071 .0497989 19.67 0.000 .881803 1.077011
                            csp2012 | .0315363 .0222354 1.42 0.156 -.0120442 .0751168
                            _cons | -.2143459 3.342937 -0.06 0.949 -6.766383 6.337691
                            --------------+----------------------------------------------------------------
                            csp2014 <- |
                            csp2013 | .7961412 .0864879 9.21 0.000 .6266279 .9656544
                            _cons | 6.387988 4.27547 1.49 0.135 -1.991779 14.76775
                            --------------+----------------------------------------------------------------
                            csrrep2014 <- |
                            csp2013 | .0238833 .0139535 1.71 0.087 -.003465 .0512316
                            csrrep2013 | .830931 .0444756 18.68 0.000 .7437604 .9181015
                            csp2014 | -.0189221 .0133641 -1.42 0.157 -.0451154 .0072711
                            _cons | 11.23263 2.92878 3.84 0.000 5.49233 16.97294
                            --------------+----------------------------------------------------------------
                            roa2012 <- |
                            csrrep2012 | 1.034393 .3241771 3.19 0.001 .3990179 1.669769
                            _cons | -64.35061 22.08696 -2.91 0.004 -107.6403 -21.06097
                            --------------+----------------------------------------------------------------
                            roa2013 <- |
                            csrrep2012 | .0134556 .3444018 0.04 0.969 -.6615595 .6884706
                            csrrep2013 | .1792114 .3208322 0.56 0.576 -.4496082 .808031
                            roa2012 | .7536004 .0496173 15.19 0.000 .6563522 .8508485
                            _cons | -11.66387 8.920036 -1.31 0.191 -29.14682 5.819076
                            --------------+----------------------------------------------------------------
                            roa2014 <- |
                            csrrep2013 | .1854684 .3669558 0.51 0.613 -.5337517 .9046886
                            csrrep2014 | -.0118446 .4074981 -0.03 0.977 -.8105263 .786837
                            roa2013 | .588486 .0683561 8.61 0.000 .4545104 .7224615
                            _cons | -8.877053 10.91728 -0.81 0.416 -30.27453 12.52043
                            ----------------+----------------------------------------------------------------
                            Variance |
                            e.csp2013 | 31.32861 5.768065 21.83847 44.94279
                            e.csrrep2012 | 6.492016 1.195277 4.525439 9.313191
                            e.csrrep2013 | .9390427 .1728918 .6545856 1.347114
                            e.csp2014 | 78.69509 14.48894 54.85658 112.8929
                            e.csrrep2014 | .8241646 .151741 .5745067 1.182314
                            e.roa2012 | 41.2324 7.5915 28.74218 59.15038
                            e.roa2013 | 5.868479 1.080475 4.090785 8.41869
                            e.roa2014 | 8.305627 1.52919 5.789666 11.91493
                            ---------------------------------------------------------------------------------
                            LR test of model vs. saturated: chi2(20) = 66.25, Prob > chi2 = 0.0000




                            I have uploaded the model in the attachment. I would like to ask where I can add the covariate rdexpenses into the sem model? For example, would this be a row under y1 y2 y3? With paths to y?
                            Attached Files

                            Comment


                            • #15
                              With SEM I have generated the following results:

                              sem (csp2012 -> csp2013) (csp2012 -> csrrep2012) (csp2012 -> csrrep2013) (csp2013 -> csp2014) (csp2013 -> csrrep2013) (csp2013 -> csrrep2014) (csp2014 ->
                              > csrrep2014) (csrrep2012 -> csrrep2013) (csrrep2012 -> roa2012) (csrrep2012 -> roa2013) (csrrep2013 -> csrrep2014) (csrrep2013 -> roa2013) (csrrep2013 ->
                              > roa2014) (csrrep2014 -> roa2014) (roa2012 -> roa2013) (roa2013 -> roa2014), nocapslatent

                              (47 observations with missing values excluded;
                              specify option 'method(mlmv)' to use all observations)

                              Endogenous variables

                              Observed: csp2013 csrrep2012 csrrep2013 csp2014 csrrep2014 roa2012 roa2013 roa2014

                              Exogenous variables

                              Observed: csp2012

                              Fitting target model:

                              Iteration 0: log likelihood = -1409.5922
                              Iteration 1: log likelihood = -1409.5922

                              Structural equation model Number of obs = 59
                              Estimation method = ml
                              Log likelihood = -1409.5922

                              ---------------------------------------------------------------------------------
                              | OIM
                              | Coef. Std. Err. z P>|z| [95% Conf. Interval]
                              ----------------+----------------------------------------------------------------
                              Structural |
                              csp2013 <- |
                              csp2012 | .8952065 .0538061 16.64 0.000 .7897486 1.000664
                              _cons | 4.812915 2.67275 1.80 0.072 -.4255786 10.05141
                              --------------+----------------------------------------------------------------
                              csrrep2012 <- |
                              csp2012 | .0293492 .0244935 1.20 0.231 -.0186571 .0773555
                              _cons | 66.6809 1.216683 54.81 0.000 64.29625 69.06556
                              --------------+----------------------------------------------------------------
                              csrrep2013 <- |
                              csp2013 | -.0384826 .0226693 -1.70 0.090 -.0829137 .0059485
                              csrrep2012 | .9794071 .0497989 19.67 0.000 .881803 1.077011
                              csp2012 | .0315363 .0222354 1.42 0.156 -.0120442 .0751168
                              _cons | -.2143459 3.342937 -0.06 0.949 -6.766383 6.337691
                              --------------+----------------------------------------------------------------
                              csp2014 <- |
                              csp2013 | .7961412 .0864879 9.21 0.000 .6266279 .9656544
                              _cons | 6.387988 4.27547 1.49 0.135 -1.991779 14.76775
                              --------------+----------------------------------------------------------------
                              csrrep2014 <- |
                              csp2013 | .0238833 .0139535 1.71 0.087 -.003465 .0512316
                              csrrep2013 | .830931 .0444756 18.68 0.000 .7437604 .9181015
                              csp2014 | -.0189221 .0133641 -1.42 0.157 -.0451154 .0072711
                              _cons | 11.23263 2.92878 3.84 0.000 5.49233 16.97294
                              --------------+----------------------------------------------------------------
                              roa2012 <- |
                              csrrep2012 | 1.034393 .3241771 3.19 0.001 .3990179 1.669769
                              _cons | -64.35061 22.08696 -2.91 0.004 -107.6403 -21.06097
                              --------------+----------------------------------------------------------------
                              roa2013 <- |
                              csrrep2012 | .0134556 .3444018 0.04 0.969 -.6615595 .6884706
                              csrrep2013 | .1792114 .3208322 0.56 0.576 -.4496082 .808031
                              roa2012 | .7536004 .0496173 15.19 0.000 .6563522 .8508485
                              _cons | -11.66387 8.920036 -1.31 0.191 -29.14682 5.819076
                              --------------+----------------------------------------------------------------
                              roa2014 <- |
                              csrrep2013 | .1854684 .3669558 0.51 0.613 -.5337517 .9046886
                              csrrep2014 | -.0118446 .4074981 -0.03 0.977 -.8105263 .786837
                              roa2013 | .588486 .0683561 8.61 0.000 .4545104 .7224615
                              _cons | -8.877053 10.91728 -0.81 0.416 -30.27453 12.52043
                              ----------------+----------------------------------------------------------------
                              Variance |
                              e.csp2013 | 31.32861 5.768065 21.83847 44.94279
                              e.csrrep2012 | 6.492016 1.195277 4.525439 9.313191
                              e.csrrep2013 | .9390427 .1728918 .6545856 1.347114
                              e.csp2014 | 78.69509 14.48894 54.85658 112.8929
                              e.csrrep2014 | .8241646 .151741 .5745067 1.182314
                              e.roa2012 | 41.2324 7.5915 28.74218 59.15038
                              e.roa2013 | 5.868479 1.080475 4.090785 8.41869
                              e.roa2014 | 8.305627 1.52919 5.789666 11.91493
                              ---------------------------------------------------------------------------------
                              LR test of model vs. saturated: chi2(20) = 66.25, Prob > chi2 = 0.0000


                              I have uploaded the model in the attachment. I would like to ask where I can add the covariate rdexpenses into the sem model? For example, would this be a row under y1 y2 y3? With paths to y?

                              Comment

                              Working...
                              X