Announcement

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

  • What is the difference between xtreg ,mle versus reg ,(cluster id), can I use the results of one to confirm the results of the other

    Hi,

    My supervisor and staticien are asking me to run my panel regression with two methods, xtreg ,mle and reg ,(cluster id). They say that both method should give me similar results however they do not. To which they replied there were some interactions of my variables. After checking everything and slicing the data in many ways for 2 weeks I'm spent.

    Here are two regressions with the methods, I only use one variable as to show that it doesnt work as intended. Both variables have skewness and kurtosis in the accetable ranges. Can someone please explain me where I go wrong ? Or at least point me toward what else I should be checking that I forget to look at.

    . tabstat qiIndResExp qrFedRD if tesregfullind!=. & year<2015& Legal>0,stat (N mean sd min max sk ku)

    stats | qiIndR~p qrFedRD
    ---------+--------------------
    N | 2568 2568
    mean | 26.46953 106.6251
    sd | 7.111316 31.72757
    min | 0 0
    max | 54.03841 246.6654
    skewness | .3247191 .5548654
    kurtosis | 4.42312 4.166172
    ------------------------------


    . pwcorr qiIndResExp qrFedRD if tesregfullind!=. & year<2015& Legal>0

    | qiIndR~p qrFedRD
    -------------+------------------
    qiIndResExp | 1.0000
    qrFedRD | 0.7479 1.0000

    . xtreg qiIndResExp qrFedRD if tesregfullind!=. & year<2015& Legal>0,mle

    Fitting constant-only model:
    Iteration 0: log likelihood = -6922.983
    Iteration 1: log likelihood = -6912.0281
    Iteration 2: log likelihood = -6911.5666
    Iteration 3: log likelihood = -6911.5626

    Fitting full model:
    Iteration 0: log likelihood = -6621.1102
    Iteration 1: log likelihood = -6578.6661
    Iteration 2: log likelihood = -6577.4219
    Iteration 3: log likelihood = -6577.4116
    Iteration 4: log likelihood = -6577.4116

    Random-effects ML regression Number of obs = 2,568
    Group variable: id Number of groups = 240

    Random effects u_i ~ Gaussian Obs per group:
    min = 1
    avg = 10.7
    max = 18

    LR chi2(1) = 668.30
    Log likelihood = -6577.4116 Prob > chi2 = 0.0000

    ------------------------------------------------------------------------------
    qiIndResExp | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    qrFedRD | .1265419 .0044836 28.22 0.000 .1177541 .1353296
    _cons | 12.23881 .5198609 23.54 0.000 11.2199 13.25771
    -------------+----------------------------------------------------------------
    /sigma_u | 4.193681 .2150688 3.792647 4.637121
    /sigma_e | 2.722282 .040055 2.644897 2.801932
    rho | .7035409 .0225329 .6579608 .7461168
    ------------------------------------------------------------------------------
    LR test of sigma_u=0: chibar2(01) = 2102.65 Prob >= chibar2 = 0.000



    . reg qiIndResExp qrFedRD if tesregfullind!=. & year<2015& Legal>0,vce (cluster id)

    Linear regression Number of obs = 2,568
    F(1, 239) = 398.44
    Prob > F = 0.0000
    R-squared = 0.5593
    Root MSE = 4.7216

    (Std. Err. adjusted for 240 clusters in id)
    ------------------------------------------------------------------------------
    | Robust
    qiIndResExp | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    qrFedRD | .1676296 .0083979 19.96 0.000 .1510863 . 1841729
    _cons | 8.596003 .877978 9.79 0.000 6.866439 10.32557
    ------------------------------------------------------------------------------


  • #2
    Arman:
    welcome to this forum.
    Set aside the comment that, if -re- specification is the right one for your data, pooled OLS would be consistent but less efficient (https://www.stata.com/bookstore/mode...etrics-stata/: page 254), you can obtain similar (although not identical) point estimates regardless -mle- or not for -xtreg-:
    Code:
    . use "http://www.stata-press.com/data/r15/nlswork.dta"
    (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
    
    . xtreg ln_wage age
    
    Random-effects GLS regression                   Number of obs     =     28,510
    Group variable: idcode                          Number of groups  =      4,710
    
    R-sq:                                           Obs per group:
         within  = 0.1026                                         min =          1
         between = 0.0877                                         avg =        6.1
         overall = 0.0774                                         max =         15
    
                                                    Wald chi2(1)      =    3140.35
    corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
    
    ------------------------------------------------------------------------------
         ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             age |   .0185667   .0003313    56.04   0.000     .0179174    .0192161
           _cons |   1.120439   .0112038   100.01   0.000      1.09848    1.142398
    -------------+----------------------------------------------------------------
         sigma_u |  .36972456
         sigma_e |  .30349389
             rho |  .59743613   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    
    . xtreg ln_wage age, mle
    
    Fitting constant-only model:
    Iteration 0:   log likelihood =  -12878.37
    Iteration 1:   log likelihood = -12864.036
    Iteration 2:   log likelihood = -12863.892
    Iteration 3:   log likelihood = -12863.892
    
    Fitting full model:
    Iteration 0:   log likelihood = -11394.585
    Iteration 1:   log likelihood = -11377.435
    Iteration 2:   log likelihood = -11377.354
    Iteration 3:   log likelihood = -11377.354
    
    Random-effects ML regression                    Number of obs     =     28,510
    Group variable: idcode                          Number of groups  =      4,710
    
    Random effects u_i ~ Gaussian                   Obs per group:
                                                                  min =          1
                                                                  avg =        6.1
                                                                  max =         15
    
                                                    LR chi2(1)        =    2973.08
    Log likelihood  = -11377.354                    Prob > chi2       =     0.0000
    
    ------------------------------------------------------------------------------
         ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             age |   .0185847    .000332    55.97   0.000      .017934    .0192355
           _cons |   1.120105   .0111594   100.37   0.000     1.098233    1.141977
    -------------+----------------------------------------------------------------
        /sigma_u |   .3602373   .0044678                       .351586    .3691014
        /sigma_e |    .304143   .0013968                      .3014175     .306893
             rho |   .5838334   .0065891                       .570876    .5967003
    ------------------------------------------------------------------------------
    LR test of sigma_u=0: chibar2(01) = 1.4e+04            Prob >= chibar2 = 0.000
    
    . reg ln_wage age, vce(cluster idcode)
    
    Linear regression                               Number of obs     =     28,510
                                                    F(1, 4709)        =     959.19
                                                    Prob > F          =     0.0000
                                                    R-squared         =     0.0774
                                                    Root MSE          =     .45924
    
                                 (Std. Err. adjusted for 4,710 clusters in idcode)
    ------------------------------------------------------------------------------
                 |               Robust
         ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             age |   .0198485   .0006409    30.97   0.000     .0185921    .0211049
           _cons |   1.098442   .0172065    63.84   0.000     1.064709    1.132175
    ------------------------------------------------------------------------------
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment

    Working...
    X