Announcement

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

  • #16
    Hi everyone.

    I have the same problem. When I use the xtmixed command, Why obtain a sd(_cons) from the random intercept (or second level) which differs greatly from the sigma_u of the xtreg command? I´m sure that my syntaxis is not wrong because first I had run a null model (without covariates) and as a coesequence both commands gives me the same coefficients, std, sigma_u, sigma_e, sd(_cons) and sd(residual). However, in a second model (model with covariates), I ran the same data but it reports me a simga_u = 0 (and also rho = 0) and the xtmixed command reports an sd(_cons) from the second level different from. Why it is happening? Thanks in advance for your help.

    Comment


    • #17
      Without posting the exact code and the exact output you got, it is unlikely anyone can give you an answer. The little details are often crucial, and you don't provide anything but a broad description of the problem. Please read the FAQ for good advice on how to post questions in ways that enhance your likelihood of getting a timely and helpful response. Also focus on FAQ #12 to learn about code delimiters so that you can post code and output readably.

      Comment


      • #18
        The following text contains the code and the output previously mentioned.


        PHP Code:
          use "appenddata2010.dta"clear 

        .         
        .         
        xtset division
               panel variable
        :  division (unbalanced)

        .         
        .         
        glob controls began_unregistered years_unregistered firmage export_orientation foreign_ownership manager_experience temporary_workers permanent_workers female_involved_
        ownership access_to_finance transport electricity quality_certification external_auditor website e_mail i.economic_sector    

        .         
        .         *
        null model
        .         xtreg gemployment if firm_size_b==mle
        Iteration 0
        :   log likelihood = -5426.7507
        Iteration 1
        :   log likelihood = -5426.4992
        Iteration 2
        :   log likelihood = -5426.4953
        Iteration 3
        :   log likelihood = -5426.4953

        Random
        -effects ML regression                    Number of obs     =      1,413
        Group variable
        division                        Number of groups  =         31

        Random effects u_i 
        Gaussian                   Obs per group:
                                                                      
        min =          1
                                                                      avg 
        =       45.6
                                                                      max 
        =        216

                                                        Wald chi2
        (0)      =       0.00
        Log likelihood  
        = -5426.4953                    Prob chi2       =          .

        ------------------------------------------------------------------------------
         
        gemployment |      Coef.   StdErr.      z    P>|z|     [95ConfInterval]
        -------------+----------------------------------------------------------------
               
        _cons |   2.281579   .4752067     4.80   0.000     1.350191    3.212967
        -------------+----------------------------------------------------------------
            /
        sigma_u |   1.498766    .458781                      .8225765    2.730811
            
        /sigma_e |   11.20319    .212167                      10.79498    11.62685
                 rho 
        |   .0175825   .0106306                      .0048458    .0519464
        ------------------------------------------------------------------------------
        LR test of sigma_u=0chibar2(01) = 9.63               Prob >= chibar2 0.001

        .         xtmixed gemployment if firm_size_b==||division:, mle 

        Performing EM optimization


        Performing gradient-based optimization

        Iteration 0:   log likelihood = -5426.4959  
        Iteration 1
        :   log likelihood = -5426.4953  
        Iteration 2
        :   log likelihood = -5426.4953  

        Computing standard errors
        :

        Mixed-effects ML regression                     Number of obs     =      1,413
        Group variable
        division                        Number of groups  =         31

                                                        Obs per group
        :
                                                                      
        min =          1
                                                                      avg 
        =       45.6
                                                                      max 
        =        216

                                                        Wald chi2
        (0)      =          .
        Log likelihood = -5426.4953                     Prob chi2       =          .

        ------------------------------------------------------------------------------
         
        gemployment |      Coef.   StdErr.      z    P>|z|     [95ConfInterval]
        -------------+----------------------------------------------------------------
               
        _cons |   2.281578   .4726836     4.83   0.000     1.355135    3.208021
        ------------------------------------------------------------------------------

        ------------------------------------------------------------------------------
          
        Random-effects Parameters  |   Estimate   StdErr.     [95ConfInterval]
        -----------------------------+------------------------------------------------
        divisionIdentity           |
                           
        sd(_cons) |   1.498773    .458782      .8225808    2.730819
        -----------------------------+------------------------------------------------
                        
        sd(Residual) |   11.20319   .2121669      10.79498    11.62685
        ------------------------------------------------------------------------------
        LR test vslinear modelchibar2(01) = 9.63          Prob >= chibar2 0.0010

        .         
        .         *
        model with covariates 
        .         xtreg gemployment $controls if firm_size_b==mle

        Fitting constant
        -only model:
        Iteration 0:   log likelihood = -4965.8246
        Iteration 1
        :   log likelihood =  -4965.642
        Iteration 2
        :   log likelihood = -4965.6419

        Fitting full model
        :
        Iteration 0:   log likelihood = -4939.2437
        Iteration 1
        :   log likelihood = -4939.1502
        Iteration 2
        :   log likelihood = -4939.1502

        Random
        -effects ML regression                    Number of obs     =      1,308
        Group variable
        division                        Number of groups  =         31

        Random effects u_i 
        Gaussian                   Obs per group:
                                                                      
        min =          1
                                                                      avg 
        =       42.2
                                                                      max 
        =        203

                                                        LR chi2
        (21)       =      52.98
        Log likelihood  
        = -4939.1502                    Prob chi2       =     0.0001

        --------------------------------------------------------------------------------------------------------
                                   
        gemployment |      Coef.   StdErr.      z    P>|z|     [95ConfInterval]
        ---------------------------------------+----------------------------------------------------------------
                            
        began_unregistered |  -.7790503   1.381053    -0.56   0.573    -3.485865    1.927765
                            years_unregistered 
        |   .0857678    .065635     1.31   0.191    -.0428745      .21441
                                       firmage 
        |   -.048905   .0140202    -3.49   0.000     -.076384    -.021426
                            export_orientation 
        |  -1.505309   .6666039    -2.26   0.024    -2.811828   -.1987892
                             foreign_ownership 
        |  -.7543359   .8783151    -0.86   0.390    -2.475802      .96713
                            manager_experience 
        |  -.0235406   .0254821    -0.92   0.356    -.0734846    .0264034
                             temporary_workers 
        |   .0001227   .0006893     0.18   0.859    -.0012284    .0014738
                             permanent_workers 
        |   .0002445   .0002621     0.93   0.351    -.0002693    .0007583
                     female_involved_ownership 
        |   .2723627    .712606     0.38   0.702    -1.124319    1.669045
                             access_to_finance 
        |   2.239303   .7097259     3.16   0.002     .8482655     3.63034
                                     transport 
        |   .3602209   .7125367     0.51   0.613    -1.036325    1.756767
                                   electricity 
        |  -.1818435   .6727118    -0.27   0.787    -1.500334    1.136647
                         quality_certification 
        |   .6279148   .6427971     0.98   0.329    -.6319444    1.887774
                              external_auditor 
        |  -.3331411   .7624314    -0.44   0.662    -1.827479    1.161197
                                       website 
        |   .2814078   .9655758     0.29   0.771    -1.611086    2.173902
                                        e_mail 
        |  -.5884869   2.684828    -0.22   0.827    -5.850653    4.673679
                                               
        |
                               
        economic_sector |
                                
        Hotels Rest  |  -1.704953   4.232523    -0.40   0.687    -10.00055    6.590639
                                Manufacturing  
        |   .6477709   2.360216     0.27   0.784    -3.978168    5.273709
        Real estate
        renting and business act  |   6.572925   2.833487     2.32   0.020     1.019393    12.12646
        Transport
        storage and communications  |   1.553171   2.853824     0.54   0.586    -4.040222    7.146563
                     Wholesale 
        Retail trade  |   1.349625   2.456442     0.55   0.583    -3.464913    6.164163
                                               
        |
                                         
        _cons |   2.774814   3.768193     0.74   0.462    -4.610709    10.16034
        ---------------------------------------+----------------------------------------------------------------
                                      /
        sigma_u |          0  (omitted)
                                      /
        sigma_e |   10.56102   .2064843                      10.16398    10.97358
                                           rho 
        |          0  (omitted)
        --------------------------------------------------------------------------------------------------------
        LR test of sigma_u=0chibar2(01) = 0.00               Prob >= chibar2 1.000

        .         xtmixed gemployment $controls if firm_size_b==||division: , mle

        Performing EM optimization


        Performing gradient-based optimization

        Iteration 0:   log likelihood = -4936.9417  
        Iteration 1
        :   log likelihood =  -4936.935  
        Iteration 2
        :   log likelihood =  -4936.935  

        Computing standard errors
        :

        Mixed-effects ML regression                     Number of obs     =      1,308
        Group variable
        division                        Number of groups  =         31

                                                        Obs per group
        :
                                                                      
        min =          1
                                                                      avg 
        =       42.2
                                                                      max 
        =        203

                                                        Wald chi2
        (21)     =      51.88
        Log likelihood 
        =  -4936.935                     Prob chi2       =     0.0002

        --------------------------------------------------------------------------------------------------------
                                   
        gemployment |      Coef.   StdErr.      z    P>|z|     [95ConfInterval]
        ---------------------------------------+----------------------------------------------------------------
                            
        began_unregistered |  -.7666805   1.378154    -0.56   0.578    -3.467813    1.934452
                            years_unregistered 
        |   .0831349    .065523     1.27   0.205    -.0452878    .2115575
                                       firmage 
        |  -.0540928   .0141128    -3.83   0.000    -.0817534   -.0264323
                            export_orientation 
        |  -1.314988   .6700306    -1.96   0.050    -2.628224   -.0017525
                             foreign_ownership 
        |   -.893929   .8777134    -1.02   0.308    -2.614216    .8263576
                            manager_experience 
        |  -.0190642   .0254847    -0.75   0.454    -.0690132    .0308848
                             temporary_workers 
        |   .0000481   .0006873     0.07   0.944     -.001299    .0013953
                             permanent_workers 
        |    .000242   .0002623     0.92   0.356     -.000272    .0007561
                     female_involved_ownership 
        |    .342937   .7103798     0.48   0.629    -1.049382    1.735256
                             access_to_finance 
        |   2.305546   .7085896     3.25   0.001     .9167362    3.694356
                                     transport 
        |   .3111839   .7102677     0.44   0.661    -1.080915    1.703283
                                   electricity 
        |  -.1955359   .6714072    -0.29   0.771     -1.51147    1.120398
                         quality_certification 
        |   .3900236    .648665     0.60   0.548    -.8813364    1.661384
                              external_auditor 
        |  -.4112777   .7600924    -0.54   0.588    -1.901031    1.078476
                                       website 
        |    .364885   .9667361     0.38   0.706    -1.529883    2.259653
                                        e_mail 
        |  -.6192891   2.676627    -0.23   0.817    -5.865382    4.626804
                                               
        |
                               
        economic_sector |
                                
        Hotels Rest  |  -1.611018   4.419231    -0.36   0.715    -10.27255    7.050517
                                Manufacturing  
        |   .3646481   2.550047     0.14   0.886    -4.633352    5.362648
        Real estate
        renting and business act  |   6.569056   3.119996     2.11   0.035     .4539764    12.68414
        Transport
        storage and communications  |   1.533619    3.05554     0.50   0.616     -4.45513    7.522367
                     Wholesale 
        Retail trade  |   1.354568   2.690641     0.50   0.615    -3.918992    6.628128
                                               
        |
                                         
        _cons |   2.875613   3.873086     0.74   0.458    -4.715497    10.46672
        --------------------------------------------------------------------------------------------------------

        ------------------------------------------------------------------------------
          
        Random-effects Parameters  |   Estimate   StdErr.     [95ConfInterval]
        -----------------------------+------------------------------------------------
        divisionIdentity           |
                           
        sd(_cons) |   .9432973   .3500096      .4558386    1.952028
        -----------------------------+------------------------------------------------
                        
        sd(Residual) |    10.5115   .2063431      10.11475     10.9238
        ------------------------------------------------------------------------------
        LR test vslinear modelchibar2(01) = 4.43          Prob >= chibar2 0.0177

        .         


        end of do-file 

        Comment


        • #19
          The maximization algorithms are different: see the iteration logs. xtreg , mle found a local maximum where the second level variance collapsed to zero.

          Parameterizations of the variance components seem to be different, too, inasmuch as mixed will allow them to go to an infinitesimal value but not completely to zero as xtreg does.

          Use the final coefficient vector from mixed as the starting values for xtreg , mle and see whether it will converge to the same maximum likelihood value.
          Code:
          mixed gemployment $controls if firm_size_b==3 || division: , mle
          matrix define B = e(b)
          xtreg gemployment $controls if firm_size_b==3, i(division) mle from(B)
          Last edited by Joseph Coveney; 10 Apr 2017, 19:19.

          Comment

          Working...
          X