Announcement

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

  • Issues with Time-Invariant Variables when using Stack Command in panel regression

    Hi everyone -

    I'm trying to use the stack command to compare the effects of the same independent variable on two different dependent variables. We're using a Hausman Taylor (HT) regression using xthtaylor, as we need to account for random effects and potential unobserved variables creating endogeneity issues.

    This becomes an issue, however, when using the stack command because we can either: 1) have all the time-invariant variables show the same in both stacks, or 2) have the time-invariant variables take on a 0 depending on it's corresponding stack. When we do option 1, our coefficients are not the same as when we run the HT regression since it's not accounting for separate time-invariant variables, and 2) it gives us an error for HT saying there are no time-invariant variables in the model.

    We did attempt to cluster the id variable in the HT regression with the stack (created a concatatend variable of id and stack number), which helped get us closer, but still not the same coefficients.

    Our main concern is we aren't sure why the results are different than when we run the models alone (i.e., just using HT regression without stack), when compared to the version with the stack command since they should be the same.

    Anyone have a solution for time-invariant variables in panel regression when using stack?

    Thanks in advance for your help!
    Last edited by Ashley Roccapriore; 23 Sep 2021, 14:23.

  • #2
    I think I got it to work by reassigning new ids to the observations corresponding to the second variable. It's annoying that the command does not support factor variables.

    Code:
    webuse psidextract, clear
    set seed 09232021
    gen depvar2=rnormal()
    xthtaylor lwage wks exp exp2 fem blk ed, endog(exp exp2 ed) constant(fem blk ed)
    xthtaylor depvar2 wks exp exp2 fem blk ed, endog(exp exp2 ed) constant(fem blk ed)
    rename (lwage depvar2) (var1 var2)
    reshape long var, i(id t) j(which) 
    qui sum id
    replace id= id + `r(max)' if which==2
    xtset id t
    gen which1=1.which
    gen which2=2.which
    gen cons=1
    foreach var in wks exp exp2 fem blk ed cons{
        gen which1`var'=which1*`var'
        gen which2`var'=which2*`var'
    }
    xthtaylor var which1wks which2wks which1exp which2exp which1exp2 which2exp2 which1fem which2fem ///
    which1blk which2blk which1ed which2ed which1cons which2cons, nocons endog(which1exp which2exp ///
    which1exp2 which2exp2 which1ed which2ed) constant(which1fem which2fem which1blk which2blk ///
    which1ed which2ed which1cons which2cons) vce(robust)
    Res.:

    Code:
    . xthtaylor lwage wks exp exp2 fem blk ed, endog(exp exp2 ed) constant(fem blk ed)
    
    Hausman-Taylor estimation                       Number of obs     =      4,165
    Group variable: id                              Number of groups  =        595
    
                                                    Obs per group:
                                                                  min =          7
                                                                  avg =          7
                                                                  max =          7
    
    Random effects u_i ~ i.i.d.                     Wald chi2(6)      =    6815.88
                                                    Prob > chi2       =     0.0000
    
    ------------------------------------------------------------------------------
           lwage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    TVexogenous  |
             wks |   .0008359   .0005999     1.39   0.164      -.00034    .0020117
    TVendogenous |
             exp |   .1137879   .0024699    46.07   0.000     .1089469    .1186288
            exp2 |  -.0004244   .0000547    -7.76   0.000    -.0005315   -.0003172
    TIexogenous  |
             fem |   .3669631   1.677234     0.22   0.827    -2.920355    3.654281
             blk |  -3.249538   9.037829    -0.36   0.719    -20.96336    14.46428
    TIendogenous |
              ed |  -2.065993   6.688445    -0.31   0.757     -15.1751    11.04312
                 |
           _cons |   31.32838   86.40063     0.36   0.717    -138.0137    200.6705
    -------------+----------------------------------------------------------------
         sigma_u |   6.185633
         sigma_e |   .1521392
             rho |  .99939542   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    Note: TV refers to time varying; TI refers to time invariant.
    
    . xthtaylor depvar2 wks exp exp2 fem blk ed, endog(exp exp2 ed) constant(fem blk ed)
    
    Hausman-Taylor estimation                       Number of obs     =      4,165
    Group variable: id                              Number of groups  =        595
    
                                                    Obs per group:
                                                                  min =          7
                                                                  avg =          7
                                                                  max =          7
    
    Random effects u_i ~ i.i.d.                     Wald chi2(6)      =       4.15
                                                    Prob > chi2       =     0.6562
    
    ------------------------------------------------------------------------------
         depvar2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    TVexogenous  |
             wks |    -.00764   .0038844    -1.97   0.049    -.0152533   -.0000267
    TVendogenous |
             exp |  -.0025355   .0159923    -0.16   0.874    -.0338797    .0288087
            exp2 |   .0000138   .0003539     0.04   0.969    -.0006798    .0007074
    TIexogenous  |
             fem |   .0227675   .4804313     0.05   0.962    -.9188605    .9643956
             blk |  -.8402209   2.590867    -0.32   0.746    -5.918227    4.237786
    TIendogenous |
              ed |  -.6169704    1.91641    -0.32   0.747    -4.373066    3.139125
                 |
           _cons |    8.35608   24.77947     0.34   0.736    -40.21079    56.92295
    -------------+----------------------------------------------------------------
         sigma_u |  1.7002202
         sigma_e |  .98507038
             rho |  .74868288   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    Note: TV refers to time varying; TI refers to time invariant.
    
    
    . xthtaylor var which1wks which2wks which1exp which2exp which1exp2 which2exp2 which1fem which2fem ///
    > which1blk which2blk which1ed which2ed which1cons which2cons, nocons endog(which1exp which2exp ///
    > which1exp2 which2exp2 which1ed which2ed) constant(which1fem which2fem which1blk which2blk ///
    > which1ed which2ed which1cons which2cons) vce(robust)
    
    Hausman-Taylor estimation                       Number of obs     =      8,330
    Group variable: id                              Number of groups  =      1,190
    
                                                    Obs per group:
                                                                  min =          7
                                                                  avg =          7
                                                                  max =          7
    
    Random effects u_i ~ i.i.d.                     Wald chi2(14)     =    3580.96
                                                    Prob > chi2       =     0.0000
    
                                     (Std. Err. adjusted for 1,190 clusters in id)
    ------------------------------------------------------------------------------
                 |               Robust
             var |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    TVexogenous  |
       which1wks |   .0008359   .0008697     0.96   0.336    -.0008687    .0025404
       which2wks |    -.00764   .0042352    -1.80   0.071    -.0159408    .0006608
    TVendogenous |
       which1exp |   .1137879   .0040289    28.24   0.000     .1058914    .1216843
       which2exp |  -.0025355   .0161228    -0.16   0.875    -.0341356    .0290646
      which1exp2 |  -.0004244   .0000822    -5.16   0.000    -.0005855   -.0002632
      which2exp2 |   .0000138   .0003547     0.04   0.969    -.0006814     .000709
    TIexogenous  |
       which1fem |   .3669631   1.761769     0.21   0.835     -3.08604    3.819967
       which2fem |   .0227675    .505234     0.05   0.964    -.9674728    1.013008
       which1blk |  -3.249538   10.13487    -0.32   0.748    -23.11351    16.61444
       which2blk |  -.8402209   2.896666    -0.29   0.772    -6.517583    4.837141
      which1cons |   31.32838   97.25625     0.32   0.747    -159.2904    221.9471
      which2cons |    8.35608   27.78633     0.30   0.764    -46.10412    62.81628
    TIendogenous |
        which1ed |  -2.065993   7.531867    -0.27   0.784    -16.82818     12.6962
        which2ed |  -.6169704   2.148765    -0.29   0.774    -4.828472    3.594531
    -------------+----------------------------------------------------------------
         sigma_u |   4.536122
         sigma_e |  .70480848
             rho |  .97642712   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    Note: TV refers to time varying; TI refers to time invariant.

    Comment


    • #3
      Thanks Andrew Musau! I apologize for the delay in replying; I've been trying to troubleshoot before replying, as I tried your same code with our data and we are having the same exact problem. I think, and could be completely wrong here, but the issue had something to do with our intercept or constant.

      For example, in the results I have below, using the code you so kindly provided, the variable "which2Cred~y" has a p-value of 0.614. But in the broken out HT regression, you can see that the same variable (labeled as " CredBinary" in that one), has a p-value of 0.085, so marginally significant.

      The only thing I can come up with is something with the constants. As you can see from the code right below this, I'm including the "which" variable as a constant to attempt to account for this. However, it's still off.

      Any advice or thoughts as to why this may be happening? I appreciate any help you (or anyone else) may be able to provide!

      ---------------------------------------------------*****************---------------------------------------------------
      This is the code I'm using, which gets me closest to our unstacked results, but still not there:
      Code:
      rename (z_LNdv1 z_dv2) (var1 var2)
      reshape long var, i(id month) j(which)
      qui sum id
      replace id=id + `r(max)' if which==2
      xtset id month
      gen which1=1.which
      gen which2=2.which
      gen cons=1
      foreach var in postwc commentwc attract fit gend ethn postsmo commentsmo numreplies vidpost postsdel profage CredBinary warmth compimage warmimage cons{
      gen which1`var'=which1*`var'
      gen which2`var'=which2*`var'
      }
      
      xthtaylor var which1postwc which1commentwc which1attract which1fit which1gend which1ethn which1postsmo which1commentsmo which1numreplies which1vidpost which1postsdel which1profage which1CredBinary which1warmth which1compimage which1warmimage which2postwc which2commentwc which2attract which2fit which2gend which2ethn which2postsmo which2commentsmo which2numreplies which2vidpost which2postsdel which2profage which2CredBinary which2warmth which2compimage which2warmimage which, vce(robust) endog(which1postwc which1commentwc which1postsmo which1commentsmo which1numreplies which1profage which1warmth which2postwc which2commentwc which2postsmo which2commentsmo which2numreplies which2profage which2warmth) constant(which1attract which1fit which1gend which1ethn which2attract which2fit which2gend which2ethn which)

      Results:
      Code:
      xthtaylor var which1postwc which1commentwc which1attract which1fit which1gend which1ethn which1postsmo which1commentsmo which1numreplies whic
      > h1vidpost which1postsdel which1profage which1CredBinary which1warmth which1compimage which1warmimage which2postwc which2commentwc which2attra
      > ct which2fit which2gend which2ethn which2postsmo which2commentsmo which2numreplies which2vidpost which2postsdel which2profage which2CredBinar
      > y which2warmth which2compimage which2warmimage which,  vce(robust) endog(which1postwc which1commentwc which1postsmo which1commentsmo which1nu
      > mreplies which1profage which1warmth which2postwc which2commentwc which2postsmo which2commentsmo which2numreplies which2profage which2warmth)
      > constant(which1attract which1fit which1gend which1ethn which2attract which2fit which2gend which2ethn which)
      
      Hausman–Taylor estimation                       Number of obs     =      5,832
      Group variable: id                              Number of groups  =        972
      
                                                      Obs per group:
                                                                    min =          6
                                                                    avg =          6
                                                                    max =          6
      
      Random effects u_i ~ i.i.d.                     Wald chi2(33)     =    3075.09
                                                      Prob > chi2       =     0.0000
      
                                         (Std. err. adjusted for 972 clusters in id)
      ------------------------------------------------------------------------------
                   |               Robust
               var | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
      TVexogenous  |
      which1vidp~t |   .0006066   .0006306     0.96   0.336    -.0006293    .0018426
      which2vidp~t |  -.0023396   .0015432    -1.52   0.129    -.0053641    .0006849
      which1post~l |   .0016425   .0027351     0.60   0.548    -.0037183    .0070032
      which2post~l |  -.0060408   .0034218    -1.77   0.077    -.0127474    .0006658
      which1Cred~y |   .0025215   .0142716     0.18   0.860    -.0254504    .0304933
      which2Cred~y |  -.0050212   .0099669    -0.50   0.614    -.0245561    .0145136
      which1comp~e |   .0233614    .005695     4.10   0.000     .0121993    .0345234
      which2comp~e |  -.0064016   .0167763    -0.38   0.703    -.0392826    .0264793
      which1warm~e |     .00497   .0026448     1.88   0.060    -.0002137    .0101537
      which2warm~e |   .0185382   .0085721     2.16   0.031     .0017372    .0353393
      
      TVendogenous |
      which1postwc |   2.59e-06   3.27e-06     0.79   0.429    -3.83e-06    9.00e-06
      which2postwc |   -.000033   .0000126    -2.62   0.009    -.0000577   -8.28e-06
      which1comm~c |   8.13e-08   8.24e-08     0.99   0.324    -8.03e-08    2.43e-07
      which2comm~c |    .000023   1.88e-06    12.28   0.000     .0000193    .0000267
      which1post~o |  -.0002648    .000626    -0.42   0.672    -.0014918    .0009621
      which2post~o |   .0031033   .0012865     2.41   0.016     .0005818    .0056249
      which1comm~o |  -1.10e-07   1.77e-07    -0.62   0.534    -4.57e-07    2.37e-07
      which2comm~o |  -.0000149   4.00e-06    -3.74   0.000    -.0000228   -7.11e-06
      which1numr~s |   8.95e-06   7.06e-06     1.27   0.205    -4.89e-06    .0000228
      which2numr~s |    .000198   .0000453     4.37   0.000     .0001092    .0002869
      which1prof~e |   .1079754   .0144306     7.48   0.000     .0796919    .1362589
      which2prof~e |   .0252472   .0276266     0.91   0.361    -.0288999    .0793944
      which1warmth |   -.012735   .0071575    -1.78   0.075    -.0267635    .0012934
      which2warmth |   .1199108   .0421445     2.85   0.004     .0373091    .2025125
      
      TIexogenous  |
      which1attr~t |   .4590263   .0896882     5.12   0.000     .2832407    .6348119
      which2attr~t |   .0758922    .022501     3.37   0.001     .0317911    .1199933
         which1fit |   .3674291    .110017     3.34   0.001     .1517998    .5830584
         which2fit |   .0256794   .0383368     0.67   0.503    -.0494594    .1008182
        which1gend |   .2004464   .0877548     2.28   0.022     .0284501    .3724426
        which2gend |   .1357634   .0309924     4.38   0.000     .0750194    .1965073
        which1ethn |   .0522698   .0976012     0.54   0.592     -.139025    .2435647
       which2ethn |   .0531484   .0463822     1.15   0.252    -.0377591    .1440559
             which |   .6777835   .1807456     3.75   0.000     .3235286    1.032038
                   |
             _cons |  -1.990053   .2963166    -6.72   0.000    -2.570823   -1.409283
      -------------+----------------------------------------------------------------
           sigma_u |  .66821243
           sigma_e |  .14033951
               rho |  .95775408   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      Note: TV refers to time varying; TI refers to time invariant.
      ---------------------------------------------------*****************---------------------------------------------------
      Now when I run the Hausman Taylor without Stacking, this is what I get:


      First DV:
      Code:
      xthtaylor z_LNdv1 postwc commentwc attract fit gend ethn postsmo commentsmo numreplies vidpost postsdel profage CredBinary warmth com
      > pimage warmimage, vce(robust) endog(postwc commentwc postsmo commentsmo numreplies profage warmth)        
      
      Hausman–Taylor estimation                       Number of obs     =      2,916
      Group variable: id                              Number of groups  =        486
      
                                                      Obs per group:
                                                                    min =          6
                                                                    avg =          6
                                                                    max =          6
      
      Random effects u_i ~ i.i.d.                     Wald chi2(16)     =     150.21
                                                      Prob > chi2       =     0.0000
      
                                         (Std. err. adjusted for 486 clusters in id)
      ------------------------------------------------------------------------------
                   |               Robust
           z_LNdv1 | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
      TVexogenous  |
           vidpost |   .0002047   .0005317     0.39   0.700    -.0008373    .0012468
          postsdel |    .002598   .0027049     0.96   0.337    -.0027035    .0078995
        CredBinary |   .0155909   .0109847     1.42   0.156    -.0059386    .0371205
         compimage |   .0141383    .005277     2.68   0.007     .0037955     .024481
         warmimage |   .0036695   .0024819     1.48   0.139     -.001195     .008534
      
      TVendogenous |
            postwc |   2.65e-06   3.14e-06     0.84   0.398    -3.50e-06    8.81e-06
         commentwc |   3.34e-08   7.37e-08     0.45   0.651    -1.11e-07    1.78e-07
           postsmo |  -.0005505   .0006189    -0.89   0.374    -.0017634    .0006625
        commentsmo |  -2.44e-08   1.56e-07    -0.16   0.876    -3.31e-07    2.82e-07
        numreplies |   8.22e-06   6.35e-06     1.29   0.196    -4.23e-06    .0000207
           profage |   .0791629   .0136328     5.81   0.000     .0524432    .1058826
            warmth |   -.013647   .0067644    -2.02   0.044     -.026905   -.0003891
      
      TIexogenous  |
           attract |   .4691929   .0911456     5.15   0.000     .2905508    .6478349
               fit |   .4052177   .1109377     3.65   0.000     .1877839    .6226516
              gend |   .2135305    .089342     2.39   0.017     .0384233    .3886376
              ethn |   .0501947   .1003869     0.50   0.617      -.14656    .2469494
                   |
             _cons |  -1.203777    .135699    -8.87   0.000    -1.469742   -.9378121
      -------------+----------------------------------------------------------------
           sigma_u |  .89746199
           sigma_e |  .07564185
               rho |  .99294628   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      Note: TV refers to time varying; TI refers to time invariant.
      Second DV:
      Code:
      xthtaylor z_dv2 postwc commentwc attract fit gend ethn postsmo commentsmo numreplies vidpost postsdel profage CredBinary warmth compimage warmimage, vce(robust) endog(postwc commentwc postsmo commentsmo numreplies profage warmth)  
      
      Hausman–Taylor estimation                       Number of obs     =      2,916
      Group variable: id                              Number of groups  =        486
      
                                                      Obs per group:
                                                                    min =          6
                                                                    avg =          6
                                                                    max =          6
      
      Random effects u_i ~ i.i.d.                     Wald chi2(16)     =    2998.24
                                                      Prob > chi2       =     0.0000
      
                                         (Std. err. adjusted for 486 clusters in id)
      ------------------------------------------------------------------------------
                   |               Robust
             z_dv2 | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
      TVexogenous  |
           vidpost |  -.0015115   .0015131    -1.00   0.318    -.0044772    .0014541
          postsdel |  -.0055198   .0034133    -1.62   0.106    -.0122099    .0011702
        CredBinary |  -.0255325   .0148094    -1.72   0.085    -.0545584    .0034935
         compimage |  -.0004394   .0169282    -0.03   0.979    -.0336181    .0327393
         warmimage |   .0193616   .0088239     2.19   0.028      .002067    .0366561
      
      TVendogenous |
            postwc |  -.0000341   .0000127    -2.69   0.007     -.000059   -9.24e-06
         commentwc |   .0000231   1.87e-06    12.31   0.000     .0000194    .0000267
           postsmo |   .0034201   .0013424     2.55   0.011     .0007892    .0060511
        commentsmo |   -.000015   3.99e-06    -3.76   0.000    -.0000228   -7.19e-06
        numreplies |    .000199   .0000457     4.36   0.000     .0001095    .0002885
           profage |   .0377401   .0231116     1.63   0.102    -.0075578     .083038
            warmth |   .1212602   .0422509     2.87   0.004       .03845    .2040703
      
      TIexogenous  |
           attract |   .0720937    .022387     3.22   0.001     .0282161    .1159714
               fit |   .0060661   .0350571     0.17   0.863    -.0626446    .0747767
              gend |   .1311991   .0290432     4.52   0.000     .0742754    .1881228
              ethn |   .0513238   .0454866     1.13   0.259    -.0378282    .1404758
                   |
             _cons |  -.6804503   .1065218    -6.39   0.000    -.8892293   -.4716713
      -------------+----------------------------------------------------------------
           sigma_u |  .29593527
           sigma_e |  .18349023
               rho |  .72231193   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      Note: TV refers to time varying; TI refers to time invariant.
      Last edited by Ashley Roccapriore; 06 Oct 2021, 10:32.

      Comment


      • #4
        If you look at my code closely, I specify the -nocons- option and include my own constants (which1cons and which2cons). It is apparent that you haven't done this. You should start by replicating what I did so that you can understand the procedure. Otherwise, post a data example using dataex for any specific code suggestions (see FAQ Advice #12 for details).

        Comment


        • #5
          Hi Andrew Musau - apologies, I should have worded my response differently. I used the -noncons- and included the constants, and the results were even further off. The code I originally included in my response was just me saying "this is what I used to get as close as I could get." I tried to do it the way you mentioned in your code exactly (see below) and the results are much different, so I included the code that got me closest to my unstacked/uncombined results.

          For example:
          In the separate one, with the CredBinary variable to the first DV the coefficient is .0155909 and p-value of 0.156. For the second DV the coefficient is -.0255325 and p-value of 0.085.

          In the combined one, the CredBinary variable to the first DV the coefficient is -.0194046 and p-value of 0.210. For the second DV the coefficient is -.0160924 and p-value of 0.116.

          So you can see that not only are the coefficients different (even flipped for the first DV), but the p-values are too (as is the case specifically for the second DV).

          To illustrate, here's me replicating your exact code:
          Code:
          xtset  id month
          xthtaylor z_LNdv1 postwc commentwc attract fit gend ethn postsmo commentsmo numreplies vidpost postsdel profage CredBinary warmth compimage warmimage, vce(robust) endog(postwc commentwc postsmo commentsmo numreplies profage warmth) constant(attract fit gend ethn)
          xthtaylor z_dv2 postwc commentwc attract fit gend ethn postsmo commentsmo numreplies vidpost postsdel profage CredBinary warmth compimage warmimage, vce(robust) endog(postwc commentwc postsmo commentsmo numreplies profage warmth) constant(attract fit gend ethn)
          rename (z_LNdv1 z_dv2) (var1 var2)
          reshape long var, i(id month) j(which)
          qui sum id
          replace id= id + `r(max)' if which==2
          xtset id month
          gen which1=1.which
          gen which2=2.which
          gen cons=1
          foreach var in postwc commentwc attract fit gend ethn postsmo commentsmo numreplies vidpost postsdel profage CredBinary warmth compimage warmimage cons{
              gen which1`var'=which1*`var'
              gen which2`var'=which2*`var'
          }
          xthtaylor var which1attract which2attract which1fit which2fit which1gend which2gend which1ethn which2ethn which1postwc which2postwc which1commentwc which2commentwc which1postsmo which2postsmo which1commentsmo which2commentsmo which1numreplies which2numreplies which1vidpost which2vidpost which1postsdel  which2postsdel which1profage which2profage which1CredBinary which2CredBinary which1compimage which2compimage which1warmth  which2warmth which1warmimage which2warmimage, nocons endog(which1postwc which2postwc which1commentwc which2commentwc which1postsmo which2postsmo which1commentsmo which2commentsmo which1numreplies which2numreplies which1warmth which2warmth) constant(which1attract which2attract which1fit which2fit which1gend which2gend which1ethn which2ethn) vce(robust)

          And the results I get from it:
          Code:
          *............... DV 1 - Separate
          
          . xthtaylor z_LNdv1 postwc commentwc attract fit gend ethn postsmo commentsmo numreplies vidpost postsdel profage CredBinary warmth compimage warmimage, vce(robust) endo
          > g(postwc commentwc postsmo commentsmo numreplies profage warmth) constant(attract fit gend ethn)
          
          Hausman–Taylor estimation                       Number of obs     =      2,916
          Group variable: id                              Number of groups  =        486
          
                                                          Obs per group:
                                                                        min =          6
                                                                        avg =          6
                                                                        max =          6
          
          Random effects u_i ~ i.i.d.                     Wald chi2(16)     =     150.21
                                                          Prob > chi2       =     0.0000
          
                                             (Std. err. adjusted for 486 clusters in id)
          ------------------------------------------------------------------------------
                       |               Robust
               z_LNdv1 | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
          -------------+----------------------------------------------------------------
          TVexogenous  |
               vidpost |   .0002047   .0005317     0.39   0.700    -.0008373    .0012468
              postsdel |    .002598   .0027049     0.96   0.337    -.0027035    .0078995
            CredBinary |   .0155909   .0109847     1.42   0.156    -.0059386    .0371205
             compimage |   .0141383    .005277     2.68   0.007     .0037955     .024481
             warmimage |   .0036695   .0024819     1.48   0.139     -.001195     .008534
          TVendogenous |
                postwc |   2.65e-06   3.14e-06     0.84   0.398    -3.50e-06    8.81e-06
             commentwc |   3.34e-08   7.37e-08     0.45   0.651    -1.11e-07    1.78e-07
               postsmo |  -.0005505   .0006189    -0.89   0.374    -.0017634    .0006625
            commentsmo |  -2.44e-08   1.56e-07    -0.16   0.876    -3.31e-07    2.82e-07
            numreplies |   8.22e-06   6.35e-06     1.29   0.196    -4.23e-06    .0000207
               profage |   .0791629   .0136328     5.81   0.000     .0524432    .1058826
                warmth |   -.013647   .0067644    -2.02   0.044     -.026905   -.0003891
          TIexogenous  |
               attract |   .4691929   .0911456     5.15   0.000     .2905508    .6478349
                   fit |   .4052177   .1109377     3.65   0.000     .1877839    .6226516
                  gend |   .2135305    .089342     2.39   0.017     .0384233    .3886376
                  ethn |   .0501947   .1003869     0.50   0.617      -.14656    .2469494
                       |
                 _cons |  -1.203777    .135699    -8.87   0.000    -1.469742   -.9378121
          -------------+----------------------------------------------------------------
               sigma_u |  .89746199
               sigma_e |  .07564185
                   rho |  .99294628   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          Note: TV refers to time varying; TI refers to time invariant.
          
          
          *............... DV 2 - Separate
          . xthtaylor z_dv2 postwc commentwc attract fit gend ethn postsmo commentsmo numreplies vidpost postsdel profage CredBinary warmth compimage warmimage, vce(robust) endog(
          > postwc commentwc postsmo commentsmo numreplies profage warmth) constant(attract fit gend ethn)
          
          Hausman–Taylor estimation                       Number of obs     =      2,916
          Group variable: id                              Number of groups  =        486
          
                                                          Obs per group:
                                                                        min =          6
                                                                        avg =          6
                                                                        max =          6
          
          Random effects u_i ~ i.i.d.                     Wald chi2(16)     =    2998.24
                                                          Prob > chi2       =     0.0000
          
                                             (Std. err. adjusted for 486 clusters in id)
          ------------------------------------------------------------------------------
                       |               Robust
                 z_dv2 | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
          -------------+----------------------------------------------------------------
          TVexogenous  |
               vidpost |  -.0015115   .0015131    -1.00   0.318    -.0044772    .0014541
              postsdel |  -.0055198   .0034133    -1.62   0.106    -.0122099    .0011702
            CredBinary |  -.0255325   .0148094    -1.72   0.085    -.0545584    .0034935
             compimage |  -.0004394   .0169282    -0.03   0.979    -.0336181    .0327393
             warmimage |   .0193616   .0088239     2.19   0.028      .002067    .0366561
          TVendogenous |
                postwc |  -.0000341   .0000127    -2.69   0.007     -.000059   -9.24e-06
             commentwc |   .0000231   1.87e-06    12.31   0.000     .0000194    .0000267
               postsmo |   .0034201   .0013424     2.55   0.011     .0007892    .0060511
            commentsmo |   -.000015   3.99e-06    -3.76   0.000    -.0000228   -7.19e-06
            numreplies |    .000199   .0000457     4.36   0.000     .0001095    .0002885
               profage |   .0377401   .0231116     1.63   0.102    -.0075578     .083038
                warmth |   .1212602   .0422509     2.87   0.004       .03845    .2040703
          TIexogenous  |
               attract |   .0720937    .022387     3.22   0.001     .0282161    .1159714
                   fit |   .0060661   .0350571     0.17   0.863    -.0626446    .0747767
                  gend |   .1311991   .0290432     4.52   0.000     .0742754    .1881228
                  ethn |   .0513238   .0454866     1.13   0.259    -.0378282    .1404758
                       |
                 _cons |  -.6804503   .1065218    -6.39   0.000    -.8892293   -.4716713
          -------------+----------------------------------------------------------------
               sigma_u |  .29593527
               sigma_e |  .18349023
                   rho |  .72231193   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          Note: TV refers to time varying; TI refers to time invariant.
          
          *............... Combined
          . xthtaylor var which1attract which2attract which1fit which2fit which1gend which2gend which1ethn which2ethn which1postwc which2postwc which1commentwc which2commentwc whi
          > ch1postsmo which2postsmo which1commentsmo which2commentsmo which1numreplies which2numreplies which1vidpost which2vidpost which1postsdel  which2postsdel which1profage w
          > hich2profage which1CredBinary which2CredBinary which1compimage which2compimage which1warmth  which2warmth which1warmimage which2warmimage, nocons endog(which1postwc wh
          > ich2postwc which1commentwc which2commentwc which1postsmo which2postsmo which1commentsmo which2commentsmo which1numreplies which2numreplies which1warmth which2warmth) c
          > onstant(which1attract which2attract which1fit which2fit which1gend which2gend which1ethn which2ethn) vce(robust)
          
          Hausman–Taylor estimation                       Number of obs     =      5,832
          Group variable: id                              Number of groups  =        972
          
                                                          Obs per group:
                                                                        min =          6
                                                                        avg =          6
                                                                        max =          6
          
          Random effects u_i ~ i.i.d.                     Wald chi2(32)     =    2093.76
                                                          Prob > chi2       =     0.0000
          
                                             (Std. err. adjusted for 972 clusters in id)
          ------------------------------------------------------------------------------
                       |               Robust
                   var | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
          -------------+----------------------------------------------------------------
          TVexogenous  |
          which1vidp~t |   .0001241   .0006218     0.20   0.842    -.0010946    .0013427
          which2vidp~t |  -.0025269   .0015408    -1.64   0.101    -.0055467     .000493
          which1post~l |    .001455   .0027985     0.52   0.603      -.00403    .0069399
          which2post~l |  -.0061856   .0033919    -1.82   0.068    -.0128336    .0004623
          which1prof~e |   .0541315   .0138564     3.91   0.000     .0269735    .0812896
          which2prof~e |  -.0143468   .0098867    -1.45   0.147    -.0337244    .0050308
          which1Cred~y |  -.0194046   .0154851    -1.25   0.210    -.0497548    .0109457
          which2Cred~y |  -.0160924   .0102245    -1.57   0.116    -.0361319    .0039472
          which1comp~e |   .0274278   .0057944     4.73   0.000      .016071    .0387847
          which2comp~e |  -.0052879   .0168673    -0.31   0.754    -.0383472    .0277713
          which1warm~e |   .0079132   .0028613     2.77   0.006     .0023052    .0135212
          which2warm~e |   .0199645   .0085566     2.33   0.020     .0031938    .0367352
          TVendogenous |
          which1postwc |  -2.87e-06   3.46e-06    -0.83   0.406    -9.66e-06    3.91e-06
          which2postwc |  -.0000355   .0000127    -2.80   0.005    -.0000604   -.0000107
          which1comm~c |   6.69e-08   7.91e-08     0.85   0.397    -8.81e-08    2.22e-07
          which2comm~c |    .000023   1.87e-06    12.31   0.000     .0000193    .0000267
          which1post~o |  -.0006132   .0006489    -0.95   0.345     -.001885    .0006585
          which2post~o |   .0029157   .0012705     2.29   0.022     .0004255     .005406
          which1comm~o |  -9.43e-08   1.70e-07    -0.56   0.579    -4.27e-07    2.38e-07
          which2comm~o |  -.0000149   3.99e-06    -3.75   0.000    -.0000227   -7.12e-06
          which1numr~s |  -5.25e-07   7.30e-06    -0.07   0.943    -.0000148    .0000138
          which2numr~s |   .0001939   .0000451     4.30   0.000     .0001056    .0002823
          which1warmth |   .0029384    .007762     0.38   0.705    -.0122748    .0181515
          which2warmth |   .1267008   .0424077     2.99   0.003     .0435832    .2098183
          TIexogenous  |
          which1attr~t |   .3238171   .0963861     3.36   0.001     .1349039    .5127303
          which2attr~t |   .0225062   .0247671     0.91   0.364    -.0260364    .0710488
             which1fit |  -.2703932   .0979016    -2.76   0.006    -.4622769   -.0785096
             which2fit |  -.2344285   .0420243    -5.58   0.000    -.3167946   -.1520625
            which1gend |  -.1535059   .0910009    -1.69   0.092    -.3318643    .0248526
            which2gend |  -.0107818   .0308066    -0.35   0.726    -.0711615     .049598
            which1ethn |  -.1768501   .1094623    -1.62   0.106    -.3913922    .0376921
            which2ethn |  -.0492448   .0476972    -1.03   0.302    -.1427296      .04424
          -------------+----------------------------------------------------------------
               sigma_u |  .67442888
               sigma_e |  .14033951
                   rho |  .95849711   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          Note: TV refers to time varying; TI refers to time invariant.
          
          .
          end of do-file
          
          .
          Last edited by Ashley Roccapriore; 07 Oct 2021, 12:29.

          Comment


          • #6
            It's difficult to tell why the coefficients are not the same. It may be an issue with your data. If you can post your data or send it to me by email (in case you cannot make it public), I'd be happy to have a look.

            Comment

            Working...
            X