Announcement

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

  • Mediation with panel data

    Hey everyone,

    I am currently struggling to find the right code for a mediation with panel data.

    I am testing this model:
    Code:
    xtreg ln_tq cvcie1 `controls' i.fyear, fe vce(cluster gvkey)
    and want to include a mediation factor (name of the mediating variable is: "ccit" and it is a count variable).

    I thought about using the -sem- command but unfortunately I have realized this is only suitable for linear relationships.


    https://www.statalist.org/forums/for...ion-panel-data
    Here, I found this explanation, hint, ... but I am struggling to transfer it to my model.

    Does anyone have useful information for this kind of mediation and/or can help me with the code in my case.

    Kind regards,
    Jana

  • #2
    -xtreg, fe- is equivalent to (and, in Stata, is implemented as) ordinary least squares regression on panel-demeaned variables. You can do that within -sem- as follows:

    Code:
    xtset gvkey // OR WHATEVER YOUR PANEL VARIABLE IS
    xi i.fyear
    xtdata ln_tq cvciel ccit `controls' _I*
    sem (ln_tq <- cvciel ccit `controls _I*) (ccit <- cvciel `controls' _I*)
    estat teffects
    Note: The code assumes all of the variables in local macro controls are continuous. If not, take the discrete ones out of `controls' and apply -xi- to them just the way I did it with fyear, so that they will be properly modeled as a set of indicators for categorical variables.

    Comment


    • #3
      Thank you

      I am getting this error:
      Code:
      . local controls "fs lev rdi ihs_cum_cvcie1_l"
      
      . 
      . xtset gvkey
      
      Panel variable: gvkey (unbalanced)
      
      . xi i.fyear
      i.fyear           _Ifyear_2009-2019   (naturally coded; _Ifyear_2009 omitted)
      
      . xtdata tq cvcie1 ccit `controls' _I*
      ratio() required
      Can you help me with that?
      Is this referring to your "note"?

      Kind regards,
      Jana

      Comment


      • #4
        Sorry, my error. I wrote the -xtdata- command incorrectly. It should be:

        Code:
        xtdata tq cvcie1 ccit `controls' _I*, fe clear 

        Comment


        • #5
          Thank you!

          I have another error where I cannot find the source of:

          Code:
           xtset gvkey 
          
          Panel variable: gvkey (unbalanced)
          
          . xi i.fyear
          i.fyear           _Ifyear_2009-2019   (naturally coded; _Ifyear_2009 omitted)
          
          . xtdata tq cvcie1 ccit `controls' _I*, fe clear 
          
          . sem (tq <- cvcie1 ccit `controls' _I*) (ccit <- cvcie1 `controls' _I*)
          
          Endogenous variables
            Observed: tq ccit
          
          Exogenous variables
            Observed: cvcie1 fs lev rdi ihs_cum_cvcie1_l _Ifyear_2010 _Ifyear_2011 _Ifyear_2012 _Ifyear_2013 _Ifyear_2014 _Ifyear_2015 _Ifyear_2016 _Ifyear_2017 _Ifyear_2018 _Ifyear_2019
          
          Fitting target model:
          initial values not feasible
          I hope you can bring me on the right track here
          Thank you!

          Kind regards,
          Jana

          Comment


          • #6
            This is a difficult problem, and it might ultimately be the case that the model cannot be estimated. You can try adding the -noivstart- option to the -sem- command and see if that works. It will likely get you past that error message, but you might end up with a model that iterates endlessly without converging.

            In that case, you should try simplifying the model. First reduce it to the bare minimum you need, involving only cvciel and ccit as predictors Then begin adding back in the covariates and time variables one at a time and go as far as you can get before estimation fails.

            Added: Another thing you can try is just run a simple regression, save the coefficient vector, and use that as starting values for -sem-. Something like this:

            Code:
            regress ln_tq cvciel ccit `controls _I*
            matrix b = e(b)
            sem (ln_tq <- cvciel ccit `controls _I*) (ccit <- cvciel `controls' _I*), from(b)
            Last edited by Clyde Schechter; 30 Nov 2021, 10:08.

            Comment


            • #7
              Thank you for your comment.

              I will try my best in solving the problem.

              Kind regards,
              Jana
              Last edited by Jana Schue; 30 Nov 2021, 10:29.

              Comment


              • #8
                Clyde:

                Due to complexity, I will follow your suggestion by running a simple regression.

                It is not clear to me why I am allowed to use a simple regression here (with non-linear panel data) and how I can interpret the results.

                Code:
                 local controls "fs lev itq rdi growth cap_exp"
                
                . 
                . regress tq cvc ccit `controls' _I*
                
                      Source |       SS           df       MS      Number of obs   =       353
                -------------+----------------------------------   F(18, 334)      =     79.24
                       Model |   331.62613        18  18.4236739   Prob > F        =    0.0000
                    Residual |  77.6562947       334  .232503876   R-squared       =    0.8103
                -------------+----------------------------------   Adj R-squared   =    0.8000
                       Total |  409.282425       352  1.16273416   Root MSE        =    .48219
                
                ------------------------------------------------------------------------------
                          tq | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                -------------+----------------------------------------------------------------
                         cvc |  -.0039719   .0018716    -2.12   0.035    -.0076535   -.0002904
                        ccit |   .0000699   .0000438     1.60   0.112    -.0000163     .000156
                          fs |  -.0179629   .0219302    -0.82   0.413    -.0611015    .0251758
                         lev |   .0245738   .0188116     1.31   0.192    -.0124304     .061578
                         itq |    .876711   .0375103    23.37   0.000     .8029248    .9504972
                         rdi |   1.337596   .5917347     2.26   0.024     .1735991    2.501592
                      growth |   .3034609   .1712617     1.77   0.077    -.0334266    .6403483
                     cap_exp |  -.1576522   .5166368    -0.31   0.760    -1.173924    .8586199
                _Ifyear_2010 |  -.1497163   .1289626    -1.16   0.247    -.4033977     .103965
                _Ifyear_2011 |   -.134043   .1276966    -1.05   0.295     -.385234     .117148
                _Ifyear_2012 |  -.1502946   .1232566    -1.22   0.224    -.3927517    .0921625
                _Ifyear_2013 |   -.110102     .12509    -0.88   0.379    -.3561656    .1359616
                _Ifyear_2014 |  -.0669615   .1252024    -0.53   0.593    -.3132461    .1793232
                _Ifyear_2015 |  -.0332752   .1225546    -0.27   0.786    -.2743514    .2078009
                _Ifyear_2016 |  -.0191286    .124942    -0.15   0.878     -.264901    .2266438
                _Ifyear_2017 |  -.0990909   .1313638    -0.75   0.451    -.3574955    .1593138
                _Ifyear_2018 |  -.1319411   .1322484    -1.00   0.319    -.3920859    .1282036
                _Ifyear_2019 |  -.1036323   .1277845    -0.81   0.418    -.3549962    .1477316
                       _cons |   .2977745   .2715751     1.10   0.274    -.2364387    .8319877
                ------------------------------------------------------------------------------
                
                . matrix b = e(b)
                
                . sem (tq <- cvc ccit `controls' _I*) (ccit <- cvc `controls' _I*), from(b)
                (2 observations with missing values excluded)
                
                Endogenous variables
                  Observed: tq ccit
                
                Exogenous variables
                  Observed: cvc fs lev itq rdi growth cap_exp _Ifyear_2010 _Ifyear_2011 _Ifyear_2012 _Ifyear_2013 _Ifyear_2014 _Ifyear_2015 _Ifyear_2016 _Ifyear_2017 _Ifyear_2018 _Ifyear_2019
                
                Fitting target model:
                Iteration 0:   log likelihood = -5215.0662  
                Iteration 1:   log likelihood = -5215.0662  
                
                Structural equation model                                  Number of obs = 353
                Estimation method: ml
                
                Log likelihood = -5215.0662
                
                --------------------------------------------------------------------------------
                               |                 OIM
                               | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
                ---------------+----------------------------------------------------------------
                Structural     |
                  tq           |
                          ccit |   .0000699   .0000426     1.64   0.101    -.0000136    .0001534
                           cvc |  -.0039719   .0018205    -2.18   0.029    -.0075401   -.0004038
                            fs |  -.0179629   .0213318    -0.84   0.400    -.0597725    .0238468
                           lev |   .0245738   .0182984     1.34   0.179    -.0112903    .0604379
                           itq |    .876711   .0364869    24.03   0.000     .8051981    .9482239
                           rdi |   1.337596   .5755896     2.32   0.020     .2094609    2.465731
                        growth |   .3034609   .1665889     1.82   0.069    -.0230474    .6299691
                       cap_exp |  -.1576522   .5025407    -0.31   0.754    -1.142614    .8273095
                  _Ifyear_2010 |  -.1497163    .125444    -1.19   0.233     -.395582    .0961493
                  _Ifyear_2011 |   -.134043   .1242125    -1.08   0.281     -.377495    .1094091
                  _Ifyear_2012 |  -.1502946   .1198936    -1.25   0.210    -.3852818    .0846926
                  _Ifyear_2013 |   -.110102    .121677    -0.90   0.366    -.3485846    .1283806
                  _Ifyear_2014 |  -.0669615   .1217863    -0.55   0.582    -.3056583    .1717353
                  _Ifyear_2015 |  -.0332752   .1192108    -0.28   0.780     -.266924    .2003736
                  _Ifyear_2016 |  -.0191286    .121533    -0.16   0.875     -.257329    .2190718
                  _Ifyear_2017 |  -.0990909   .1277796    -0.78   0.438    -.3495343    .1513525
                  _Ifyear_2018 |  -.1319411   .1286401    -1.03   0.305    -.3840711    .1201888
                  _Ifyear_2019 |  -.1036323    .124298    -0.83   0.404    -.3472519    .1399873
                         _cons |   .2977745   .2641653     1.13   0.260    -.2199801    .8155291
                  -------------+----------------------------------------------------------------
                  ccit         |
                           cvc |   5.270573   2.257229     2.33   0.020     .8464854    9.694661
                            fs |   50.67217    26.5157     1.91   0.056    -1.297646     102.642
                           lev |  -49.60898   22.70942    -2.18   0.029    -94.11862   -5.099334
                           itq |   22.93854   45.57121     0.50   0.615    -66.37938    112.2565
                           rdi |   5405.976   659.0869     8.20   0.000     4114.189    6697.763
                        growth |   570.0856   205.9167     2.77   0.006     166.4963    973.6748
                       cap_exp |  -103.5488   627.8623    -0.16   0.869    -1334.136    1127.039
                  _Ifyear_2010 |  -284.5968    155.999    -1.82   0.068    -590.3493    21.15567
                  _Ifyear_2011 |  -146.6573   154.9977    -0.95   0.344    -450.4471    157.1326
                  _Ifyear_2012 |  -177.2931   149.5005    -1.19   0.236    -470.3087    115.7225
                  _Ifyear_2013 |  -416.9168    150.398    -2.77   0.006    -711.6915   -122.1421
                  _Ifyear_2014 |  -500.0086   149.8175    -3.34   0.001    -793.6454   -206.3717
                  _Ifyear_2015 |  -528.3734   146.2658    -3.61   0.000    -815.0491   -241.6977
                  _Ifyear_2016 |  -677.6323   147.5008    -4.59   0.000    -966.7286    -388.536
                  _Ifyear_2017 |  -763.5327   154.3921    -4.95   0.000    -1066.136   -460.9298
                  _Ifyear_2018 |  -746.2846   155.7406    -4.79   0.000     -1051.53   -441.0387
                  _Ifyear_2019 |  -691.2249   150.8803    -4.58   0.000    -986.9448    -395.505
                         _cons |  -82.86374   330.0251    -0.25   0.802    -729.7011    563.9736
                ---------------+----------------------------------------------------------------
                      var(e.tq)|   .2199895   .0165588                      .1898153    .2549604
                    var(e.ccit)|     343417   25849.34                      296313.2    398008.7
                --------------------------------------------------------------------------------
                Note: The LR test of model vs. saturated is not reported because the fitted
                      model is not full rank.
                I really hope you can help me with this problem.

                Kind regards,
                Jana

                Comment


                • #9
                  What specific non-linearity in the panel data are you concerned with? You yourself proposed a linear model in #1, and just inquired how to add mediation by ccit into it.

                  As for interpreting the results, to understand the mediation calculations you need to run -estat teffects- after -sem-.

                  Comment


                  • #10
                    Maybe I am on the wrong track.

                    Background: I want to analyze if Corporate Venture Capital has an influence on the financial performance of a company.
                    I have decided that I will add zeros to my panel data whenever a company has not invested in a time period (2009-2019).
                    The qualitatively meaning of the zeros follows the same logic: The amount of investment; no investment = zero amount.

                    Because of that, I have a lot of zeros and it doesn't look linear.

                    I am confused now.

                    Can I use this model at all?

                    But nevertheless:
                    I am getting a different direct effect (tq <- cvc) then using:

                    Code:
                    regress tq cvc ccit `controls' _I*
                    matrix b = e(b)
                    sem (tq <- cvc ccit `controls' _I*) (ccit <- cvc `controls' _I*), from(b)
                    estat teffects
                    as if I am using the commend:

                    Code:
                    xtreg tq cvc `controls' i.fyear, fe vce(cluster gvkey)
                    Am I still be able to analysis the mediation then?

                    Kind regards,
                    Jana

                    Comment


                    • #11
                      For comparison, the regress and sem commands should be done on the data after -xtdata ..., fe-. And the -xtreg- should be done before -xtdata-. I think for more specific advice, you should post the complete sequence of commands and output. Without seeing the details, it's difficult to troubleshoot.

                      As for whether a linear model is appropriate, it might or might not be. The use of 0 to represent no contribution from venture capital is definitely correct. It's the correct value of the amount of venture capital. The question is whether a linear model is applicable. You might want to explore that graphically to see.

                      Comment


                      • #12
                        Clyde:
                        Thank you so much!

                        I opened another post about this topic here:
                        https://www.statalist.org/forums/for...ear-regression

                        (Where I also provide more code and a plot)

                        Kind regards,
                        Jana

                        Comment


                        • #13
                          Clyde:
                          Thanks so far.

                          As you asked here is the hole sequence of code and results:

                          Code:

                          Code:
                          local controls "fs lev itq rdi growth cap_exp"
                          
                          xtreg tq cvc `controls' i.fyear, fe vce(cluster gvkey)    
                          xi i.fyear
                          xtdata tq cvc ccit `controls' _I*, fe
                          regress tq cvc ccit `controls' _I*
                          matrix b = e(b)
                          sem (tq <- cvc ccit `controls' _I*) (ccit <- cvc `controls' _I*), from(b)
                          estat teffects

                          Results:

                          Code:
                          . local controls "fs lev itq rdi growth cap_exp"
                          
                          . 
                          . xtreg tq cvc `controls' i.fyear, fe vce(cluster gvkey)  
                          
                          Fixed-effects (within) regression               Number of obs     =        353
                          Group variable: gvkey                           Number of groups  =         34
                          
                          R-squared:                                      Obs per group:
                               Within  = 0.5024                                         min =          2
                               Between = 0.4515                                         avg =       10.4
                               Overall = 0.4733                                         max =         11
                          
                                                                          F(17,33)          =      31.15
                          corr(u_i, Xb) = 0.0740                          Prob > F          =     0.0000
                          
                                                           (Std. err. adjusted for 34 clusters in gvkey)
                          ------------------------------------------------------------------------------
                                       |               Robust
                                    tq | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                          -------------+----------------------------------------------------------------
                                   cvc |  -.0004955   .0020686    -0.24   0.812    -.0047041     .003713
                                    fs |  -.1565618   .1077493    -1.45   0.156    -.3757794    .0626558
                                   lev |   .0371103   .0150445     2.47   0.019     .0065021    .0677186
                                   itq |    .685569   .1433776     4.78   0.000     .3938652    .9772729
                                   rdi |  -6.298757   5.390539    -1.17   0.251    -17.26589    4.668377
                                growth |   .0939487   .1110024     0.85   0.403    -.1318875    .3197848
                               cap_exp |   1.192223   .7782992     1.53   0.135    -.3912389    2.775684
                                       |
                                 fyear |
                                 2010  |  -.1237752   .0610782    -2.03   0.051    -.2480398    .0004894
                                 2011  |  -.1557566   .0697817    -2.23   0.033    -.2977285   -.0137846
                                 2012  |  -.1343674    .075972    -1.77   0.086    -.2889337    .0201988
                                 2013  |  -.0314902   .0584656    -0.54   0.594    -.1504393    .0874589
                                 2014  |   .0033938   .0763937     0.04   0.965    -.1520302    .1588179
                                 2015  |   .0466549   .0763477     0.61   0.545    -.1086757    .2019855
                                 2016  |   .0999757   .0848034     1.18   0.247    -.0725581    .2725095
                                 2017  |   .0848351      .0936     0.91   0.371    -.1055954    .2752657
                                 2018  |   .0135201   .0985238     0.14   0.892    -.1869281    .2139683
                                 2019  |   .0607907    .094598     0.64   0.525    -.1316703    .2532517
                                       |
                                 _cons |   2.321139   1.365598     1.70   0.099    -.4571896    5.099468
                          -------------+----------------------------------------------------------------
                               sigma_u |  .74063035
                               sigma_e |  .29752864
                                   rho |  .86104329   (fraction of variance due to u_i)
                          ------------------------------------------------------------------------------
                          
                          . xi i.fyear
                          i.fyear           _Ifyear_2009-2019   (naturally coded; _Ifyear_2009 omitted)
                          
                          . xtdata tq cvc ccit `controls' _I*, fe
                          
                          . regress tq cvc ccit `controls' _I*
                          
                                Source |       SS           df       MS      Number of obs   =       353
                          -------------+----------------------------------   F(18, 334)      =     18.74
                                 Model |   26.999568        18    1.499976   Prob > F        =    0.0000
                              Residual |   26.729733       334  .080029141   R-squared       =    0.5025
                          -------------+----------------------------------   Adj R-squared   =    0.4757
                                 Total |   53.729301       352   .15264006   Root MSE        =    .28289
                          
                          ------------------------------------------------------------------------------
                                    tq | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                          -------------+----------------------------------------------------------------
                                   cvc |  -.0004532   .0012183    -0.37   0.710    -.0028498    .0019434
                                  ccit |  -7.27e-06   .0000314    -0.23   0.817     -.000069    .0000544
                                    fs |  -.1594654   .0607269    -2.63   0.009    -.2789208     -.04001
                                   lev |   .0364615   .0178038     2.05   0.041     .0014399    .0714832
                                   itq |   .6833673   .0537057    12.72   0.000     .5777232    .7890113
                                   rdi |  -6.338183   1.828336    -3.47   0.001    -9.934687   -2.741678
                                growth |   .0953291   .1121163     0.85   0.396     -.125214    .3158722
                               cap_exp |   1.176943   .8105571     1.45   0.147    -.4174977    2.771383
                          _Ifyear_2010 |  -.1248667   .0764853    -1.63   0.104    -.2753203    .0255869
                          _Ifyear_2011 |   -.156071   .0763537    -2.04   0.042    -.3062658   -.0058763
                          _Ifyear_2012 |  -.1346422   .0738301    -1.82   0.069    -.2798728    .0105884
                          _Ifyear_2013 |  -.0327573   .0746876    -0.44   0.661    -.1796748    .1141601
                          _Ifyear_2014 |   .0018312   .0748426     0.02   0.980    -.1453911    .1490535
                          _Ifyear_2015 |    .044518   .0731069     0.61   0.543    -.0992901    .1883261
                          _Ifyear_2016 |   .0971323   .0758735     1.28   0.201    -.0521178    .2463825
                          _Ifyear_2017 |   .0822827   .0817165     1.01   0.315    -.0784613    .2430266
                          _Ifyear_2018 |   .0107374   .0810037     0.13   0.895    -.1486043    .1700791
                          _Ifyear_2019 |   .0585322    .080192     0.73   0.466    -.0992128    .2162772
                                 _cons |   2.363938   .6631948     3.56   0.000     1.059372    3.668503
                          ------------------------------------------------------------------------------
                          
                          . matrix b = e(b)
                          
                          . sem (tq <- cvc ccit `controls' _I*) (ccit <- cvc `controls' _I*), from(b)
                          
                          Endogenous variables
                            Observed: tq ccit
                          
                          Exogenous variables
                            Observed: cvc fs lev itq rdi growth cap_exp _Ifyear_2010 _Ifyear_2011 _Ifyear_2012 _Ifyear_2013
                                      _Ifyear_2014 _Ifyear_2015 _Ifyear_2016 _Ifyear_2017 _Ifyear_2018 _Ifyear_2019
                          
                          Fitting target model:
                          Iteration 0:   log likelihood = -2729.0233  
                          Iteration 1:   log likelihood = -2729.0233  
                          
                          Structural equation model                                  Number of obs = 353
                          Estimation method: ml
                          
                          Log likelihood = -2729.0233
                          
                          --------------------------------------------------------------------------------
                                         |                 OIM
                                         | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
                          ---------------+----------------------------------------------------------------
                          Structural     |
                            tq           |
                                    ccit |  -7.27e-06   .0000305    -0.24   0.812    -.0000671    .0000525
                                     cvc |  -.0004532   .0011851    -0.38   0.702    -.0027759    .0018696
                                      fs |  -.1594654     .05907    -2.70   0.007    -.2752404   -.0436903
                                     lev |   .0364615    .017318     2.11   0.035     .0025188    .0704042
                                     itq |   .6833673   .0522404    13.08   0.000      .580978    .7857565
                                     rdi |  -6.338183   1.778451    -3.56   0.000    -9.823882   -2.852483
                                  growth |   .0953291   .1090573     0.87   0.382    -.1184193    .3090775
                                 cap_exp |   1.176943   .7884415     1.49   0.136    -.3683744     2.72226
                            _Ifyear_2010 |  -.1248667   .0743984    -1.68   0.093     -.270685    .0209515
                            _Ifyear_2011 |   -.156071   .0742704    -2.10   0.036    -.3016384   -.0105037
                            _Ifyear_2012 |  -.1346422   .0718157    -1.87   0.061    -.2753983     .006114
                            _Ifyear_2013 |  -.0327573   .0726498    -0.45   0.652    -.1751484    .1096337
                            _Ifyear_2014 |   .0018312   .0728006     0.03   0.980    -.1408553    .1445177
                            _Ifyear_2015 |    .044518   .0711123     0.63   0.531    -.0948595    .1838955
                            _Ifyear_2016 |   .0971323   .0738033     1.32   0.188    -.0475195    .2417842
                            _Ifyear_2017 |   .0822827    .079487     1.04   0.301    -.0735089    .2380742
                            _Ifyear_2018 |   .0107374   .0787936     0.14   0.892    -.1436951    .1651699
                            _Ifyear_2019 |   .0585322    .078004     0.75   0.453    -.0943528    .2114173
                                   _cons |   2.363938   .6450999     3.66   0.000     1.099565     3.62831
                            -------------+----------------------------------------------------------------
                            ccit         |
                                     cvc |   5.821701   2.043668     2.85   0.004     1.816185    9.827216
                                      fs |  -399.2307   100.8144    -3.96   0.000    -596.8233   -201.6381
                                     lev |   -89.2062   29.83045    -2.99   0.003    -147.6728   -30.73959
                                     itq |  -302.7329   89.68126    -3.38   0.001    -478.5049   -126.9608
                                     rdi |  -5420.758   3088.513    -1.76   0.079    -11474.13    632.6157
                                  growth |   189.7999   189.9484     1.00   0.318    -182.4922    562.0921
                                 cap_exp |  -2100.929    1370.64    -1.53   0.125    -4787.334    585.4751
                            _Ifyear_2010 |  -150.0779   129.5191    -1.16   0.247    -403.9306    103.7748
                            _Ifyear_2011 |  -43.23429   129.5214    -0.33   0.739    -297.0917    210.6231
                            _Ifyear_2012 |  -37.77697   125.2442    -0.30   0.763    -283.2511    207.6972
                            _Ifyear_2013 |  -174.2259   126.3755    -1.38   0.168    -421.9173    73.46548
                            _Ifyear_2014 |  -214.8536   126.4622    -1.70   0.089     -462.715     33.0078
                            _Ifyear_2015 |  -293.8044   123.0437    -2.39   0.017    -534.9657   -52.64309
                            _Ifyear_2016 |  -390.9503   127.0343    -3.08   0.002     -639.933   -141.9677
                            _Ifyear_2017 |  -350.9541   137.3764    -2.55   0.011    -620.2069   -81.70136
                            _Ifyear_2018 |  -382.6089    135.914    -2.82   0.005    -648.9954   -116.2225
                            _Ifyear_2019 |  -310.5291   135.0463    -2.30   0.021     -575.215   -45.84314
                                   _cons |   5884.515   1080.709     5.45   0.000     3766.365    8002.665
                          ---------------+----------------------------------------------------------------
                                var(e.tq)|   .0757216   .0056996                      .0653355    .0877588
                              var(e.ccit)|   230360.8   17339.48                        198764    266980.4
                          --------------------------------------------------------------------------------
                          Warning: The LR test of model vs. saturated is not reported because the
                                   fitted model is not full rank. There appears to be 3 more fitted
                                   parameters than the data can support.
                          
                          . estat teffects
                          
                          
                          Direct effects
                          --------------------------------------------------------------------------------
                                         |                 OIM
                                         | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
                          ---------------+----------------------------------------------------------------
                          Structural     |
                            tq           |
                                    ccit |  -7.27e-06   .0000305    -0.24   0.812    -.0000671    .0000525
                                     cvc |  -.0004532   .0011851    -0.38   0.702    -.0027759    .0018696
                                      fs |  -.1594654     .05907    -2.70   0.007    -.2752404   -.0436903
                                     lev |   .0364615    .017318     2.11   0.035     .0025188    .0704042
                                     itq |   .6833673   .0522404    13.08   0.000      .580978    .7857565
                                     rdi |  -6.338183   1.778451    -3.56   0.000    -9.823882   -2.852483
                                  growth |   .0953291   .1090573     0.87   0.382    -.1184193    .3090775
                                 cap_exp |   1.176943   .7884415     1.49   0.136    -.3683744     2.72226
                            _Ifyear_2010 |  -.1248667   .0743984    -1.68   0.093     -.270685    .0209515
                            _Ifyear_2011 |   -.156071   .0742704    -2.10   0.036    -.3016384   -.0105037
                            _Ifyear_2012 |  -.1346422   .0718157    -1.87   0.061    -.2753983     .006114
                            _Ifyear_2013 |  -.0327573   .0726498    -0.45   0.652    -.1751484    .1096337
                            _Ifyear_2014 |   .0018312   .0728006     0.03   0.980    -.1408553    .1445177
                            _Ifyear_2015 |    .044518   .0711123     0.63   0.531    -.0948595    .1838955
                            _Ifyear_2016 |   .0971323   .0738033     1.32   0.188    -.0475195    .2417842
                            _Ifyear_2017 |   .0822827    .079487     1.04   0.301    -.0735089    .2380742
                            _Ifyear_2018 |   .0107374   .0787936     0.14   0.892    -.1436951    .1651699
                            _Ifyear_2019 |   .0585322    .078004     0.75   0.453    -.0943528    .2114173
                            -------------+----------------------------------------------------------------
                            ccit         |
                                     cvc |   5.821701   2.043668     2.85   0.004     1.816185    9.827216
                                      fs |  -399.2307   100.8144    -3.96   0.000    -596.8233   -201.6381
                                     lev |   -89.2062   29.83045    -2.99   0.003    -147.6728   -30.73959
                                     itq |  -302.7329   89.68126    -3.38   0.001    -478.5049   -126.9608
                                     rdi |  -5420.758   3088.513    -1.76   0.079    -11474.13    632.6157
                                  growth |   189.7999   189.9484     1.00   0.318    -182.4922    562.0921
                                 cap_exp |  -2100.929    1370.64    -1.53   0.125    -4787.334    585.4751
                            _Ifyear_2010 |  -150.0779   129.5191    -1.16   0.247    -403.9306    103.7748
                            _Ifyear_2011 |  -43.23429   129.5214    -0.33   0.739    -297.0917    210.6231
                            _Ifyear_2012 |  -37.77697   125.2442    -0.30   0.763    -283.2511    207.6972
                            _Ifyear_2013 |  -174.2259   126.3755    -1.38   0.168    -421.9173    73.46548
                            _Ifyear_2014 |  -214.8536   126.4622    -1.70   0.089     -462.715     33.0078
                            _Ifyear_2015 |  -293.8044   123.0437    -2.39   0.017    -534.9657   -52.64309
                            _Ifyear_2016 |  -390.9503   127.0343    -3.08   0.002     -639.933   -141.9677
                            _Ifyear_2017 |  -350.9541   137.3764    -2.55   0.011    -620.2069   -81.70136
                            _Ifyear_2018 |  -382.6089    135.914    -2.82   0.005    -648.9954   -116.2225
                            _Ifyear_2019 |  -310.5291   135.0463    -2.30   0.021     -575.215   -45.84314
                          --------------------------------------------------------------------------------
                          
                          
                          Indirect effects
                          --------------------------------------------------------------------------------
                                         |                 OIM
                                         | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
                          ---------------+----------------------------------------------------------------
                          Structural     |
                            tq           |
                                    ccit |          0  (no path)
                                     cvc |  -.0000423   .0001783    -0.24   0.812    -.0003917    .0003071
                                      fs |   .0029036   .0122047     0.24   0.812    -.0210172    .0268244
                                     lev |   .0006488   .0027308     0.24   0.812    -.0047035     .006001
                                     itq |   .0022018    .009261     0.24   0.812    -.0159494     .020353
                                     rdi |   .0394252   .1669345     0.24   0.813    -.2877605    .3666109
                                  growth |  -.0013804   .0059543    -0.23   0.817    -.0130506    .0102898
                                 cap_exp |   .0152801    .064881     0.24   0.814    -.1118843    .1424445
                            _Ifyear_2010 |   .0010915   .0046756     0.23   0.815    -.0080724    .0102554
                            _Ifyear_2011 |   .0003144   .0016211     0.19   0.846    -.0028629    .0034917
                            _Ifyear_2012 |   .0002748   .0014692     0.19   0.852    -.0026049    .0031544
                            _Ifyear_2013 |   .0012671   .0053954     0.23   0.814    -.0093077     .011842
                            _Ifyear_2014 |   .0015626   .0066205     0.24   0.813    -.0114134    .0145386
                            _Ifyear_2015 |   .0021368   .0090101     0.24   0.813    -.0155226    .0197963
                            _Ifyear_2016 |   .0028434   .0119657     0.24   0.812     -.020609    .0262957
                            _Ifyear_2017 |   .0025525    .010756     0.24   0.812    -.0185289    .0236339
                            _Ifyear_2018 |   .0027827   .0117172     0.24   0.812    -.0201826     .025748
                            _Ifyear_2019 |   .0022585   .0095267     0.24   0.813    -.0164135    .0209304
                            -------------+----------------------------------------------------------------
                            ccit         |
                                     cvc |          0  (no path)
                                      fs |          0  (no path)
                                     lev |          0  (no path)
                                     itq |          0  (no path)
                                     rdi |          0  (no path)
                                  growth |          0  (no path)
                                 cap_exp |          0  (no path)
                            _Ifyear_2010 |          0  (no path)
                            _Ifyear_2011 |          0  (no path)
                            _Ifyear_2012 |          0  (no path)
                            _Ifyear_2013 |          0  (no path)
                            _Ifyear_2014 |          0  (no path)
                            _Ifyear_2015 |          0  (no path)
                            _Ifyear_2016 |          0  (no path)
                            _Ifyear_2017 |          0  (no path)
                            _Ifyear_2018 |          0  (no path)
                            _Ifyear_2019 |          0  (no path)
                          --------------------------------------------------------------------------------
                          
                          
                          Total effects
                          --------------------------------------------------------------------------------
                                         |                 OIM
                                         | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
                          ---------------+----------------------------------------------------------------
                          Structural     |
                            tq           |
                                    ccit |  -7.27e-06   .0000305    -0.24   0.812    -.0000671    .0000525
                                     cvc |  -.0004955   .0011718    -0.42   0.672    -.0027922    .0018011
                                      fs |  -.1565618   .0578047    -2.71   0.007    -.2698569   -.0432666
                                     lev |   .0371103   .0171041     2.17   0.030     .0035869    .0706338
                                     itq |    .685569   .0514212    13.33   0.000     .5847853    .7863528
                                     rdi |  -6.298757   1.770884    -3.56   0.000    -9.769626   -2.827889
                                  growth |   .0939487   .1089122     0.86   0.388    -.1195152    .3074126
                                 cap_exp |   1.192223   .7858939     1.52   0.129    -.3481011    2.732547
                            _Ifyear_2010 |  -.1237752   .0742633    -1.67   0.096    -.2693286    .0217782
                            _Ifyear_2011 |  -.1557566   .0742647    -2.10   0.036    -.3013127   -.0102005
                            _Ifyear_2012 |  -.1343674   .0718122    -1.87   0.061    -.2751168    .0063819
                            _Ifyear_2013 |  -.0314902   .0724609    -0.43   0.664    -.1735108    .1105305
                            _Ifyear_2014 |   .0033938   .0725106     0.05   0.963    -.1387243     .145512
                            _Ifyear_2015 |   .0466549   .0705505     0.66   0.508    -.0916216    .1849313
                            _Ifyear_2016 |   .0999757   .0728386     1.37   0.170    -.0427853    .2427368
                            _Ifyear_2017 |   .0848351   .0787685     1.08   0.281    -.0695483    .2392186
                            _Ifyear_2018 |   .0135201     .07793     0.17   0.862    -.1392199    .1662601
                            _Ifyear_2019 |   .0607907   .0774325     0.79   0.432    -.0909743    .2125557
                            -------------+----------------------------------------------------------------
                            ccit         |
                                     cvc |   5.821701   2.043668     2.85   0.004     1.816185    9.827216
                                      fs |  -399.2307   100.8144    -3.96   0.000    -596.8233   -201.6381
                                     lev |   -89.2062   29.83045    -2.99   0.003    -147.6728   -30.73959
                                     itq |  -302.7329   89.68126    -3.38   0.001    -478.5049   -126.9608
                                     rdi |  -5420.758   3088.513    -1.76   0.079    -11474.13    632.6157
                                  growth |   189.7999   189.9484     1.00   0.318    -182.4922    562.0921
                                 cap_exp |  -2100.929    1370.64    -1.53   0.125    -4787.334    585.4751
                            _Ifyear_2010 |  -150.0779   129.5191    -1.16   0.247    -403.9306    103.7748
                            _Ifyear_2011 |  -43.23429   129.5214    -0.33   0.739    -297.0917    210.6231
                            _Ifyear_2012 |  -37.77697   125.2442    -0.30   0.763    -283.2511    207.6972
                            _Ifyear_2013 |  -174.2259   126.3755    -1.38   0.168    -421.9173    73.46548
                            _Ifyear_2014 |  -214.8536   126.4622    -1.70   0.089     -462.715     33.0078
                            _Ifyear_2015 |  -293.8044   123.0437    -2.39   0.017    -534.9657   -52.64309
                            _Ifyear_2016 |  -390.9503   127.0343    -3.08   0.002     -639.933   -141.9677
                            _Ifyear_2017 |  -350.9541   137.3764    -2.55   0.011    -620.2069   -81.70136
                            _Ifyear_2018 |  -382.6089    135.914    -2.82   0.005    -648.9954   -116.2225
                            _Ifyear_2019 |  -310.5291   135.0463    -2.30   0.021     -575.215   -45.84314
                          --------------------------------------------------------------------------------
                          
                          . 
                          end of do-file

                          I would be so thankful if you could help me with the interprestation of the results.


                          Kinde regards,
                          Jana

                          Comment


                          • #14
                            First, the -xtreg, fe- that you show at the top of the output in #13 does not contain the ccit variable, so you cannot meaningfully compare it to anything done later. So just ignore that part of the output.

                            To understand what the mediation model analysis is telling you skip down to the output that follows the -estat teffects- command.

                            The fundamental question you are trying to answer is whether ccit mediates the effect of cvc on tq. The key output to look at for this question is the coefficient of tq:cvc in the Indirect Effects output. If this were exactly zero, it would imply that none of the effect of cvc on tq is mediated by ccit. In the output you show, this coefficient is -.0000423 with a 95% CI of -.0003917 to .0003071. Now, this number is very small in magnitude and the width of the confidence interval is almost 10 times wider than the magnitude of the coefficient itself. So the data are not able to identify with any meaningful precision the magnitude, nor even the direction, of any ccit-mediated effect of cvc on tq. That said, it is still worth asking what fraction of the total cv effect, this indirect effect is. Calculating -.0000423/-.0004955 (the denominator is the coefficient of tq:cvc in the Total Effects output, we see that if we were to take the -0.0000423 value literally despite the very wide CI around it, it would constitute about 8.5% of the total effect. On the other hand, if the mediated effect were more like the confidence bound of -0.0003917, we would be talking about almost 80% of the effect being mediated (assuming the total effect remained at -0.0004955.) So this analysis leaves great uncertainty as to whether there is substantial mediation here. It is an inconclusive study with respect to this mediation question. A study with more or better quality data might give a more precise answer one way or another, but you would have to consider whether it is worth the effort and expense.

                            Comment


                            • #15
                              Hi,

                              I have a question regarding using mediation analysis in Stata, with panel data, in the format country year (128 countries for 16 years).

                              Name of the variables ( Y - dependent variable; M- Mediator; X - Independent Variable)

                              Y - v2x_polyarchy; M - l.v2xcs_ccsi; X - l.CSOdisbursementsSector150_pc

                              sem (l.v2xcs_ccsi <- l.CSOdisbursementsSector150_pc l.CSOdisbAllSectorsexclgov_pc l.totaldisbursementsexclCSO_pc l.log_GDPpc l.v2clrspct l.conflict)(v2x_polyarchy <- l.v2xcs_ccsi l.CSOdisbursementsSector150_pc l.CSOdisbAllSectorsexclgov_pc l.totaldisbursementsexclCSO_pc l.log_GDPpc l.v2clrspct l.conflict), nocapslatent

                              estat teffects

                              Our question: Is it appropriate to use sem, with our panel data (country year? If not do you have any alternative options?


                              However, we are getting weird results; we didnt expect that the direct effect is negative. Can you help us with interpretation?
                              Mediator: Core Civil Society Index
                              Total Effect Direct Effect Indirect Effect
                              CSO democracy assistance p.c 0.005*

                              (0.002)
                              -0.005***

                              (0.001)
                              0.01***

                              (0.002)[CHK1]

                              Comment

                              Working...
                              X