Announcement

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

  • LR test for multilevel estimation with bhhh

    I am adapted to use the xtmixed command for multilevel models. With this command, the LR test vs. linear model is as standard outuput. I had to run a model with bhhh maxization, but the result of the lr test did not come. How can I perform the lr comparison test with the OLS model after using the bhhh estimation?
    Command used for Model HLM:meglm da tempo avgroa avgat avgend i.setor i.SL avgpib avghdi avgcpibot if ifrs == 2 || paĆ­s:tempo || id: tempo, family(gaussian) link(identity) difficult technique(bhhh) nonrtolerance

    Thanks,

  • #2
    You can use the lrtest command or calculate the test statistic by hand. Here is an example where I replicate the test at the foot of the meglm output table.

    Code:
    webuse nlswork, clear
    regress ln_w grade age c.age#c.age ttl_exp tenure c.tenure#c.tenure
    estimates store m1
    meglm ln_w grade age c.age#c.age ttl_exp tenure c.tenure#c.tenure || id:, family(gaussian) link(identity)
    estimates store m2
    lrtest m1 m2, force
    Res.:

    Code:
    . meglm ln_w grade age c.age#c.age ttl_exp tenure c.tenure#c.tenure || id:, family(gaussian) link(identity)
    
    Fitting fixed-effects model:
    
    Iteration 0:   log likelihood =     -13550  
    Iteration 1:   log likelihood =     -13550  
    
    Refining starting values:
    
    Grid node 0:   log likelihood = -11021.153
    
    Fitting full model:
    
    Iteration 0:   log likelihood = -11021.153  
    Iteration 1:   log likelihood = -9302.8602  
    Iteration 2:   log likelihood = -9171.3842  
    Iteration 3:   log likelihood = -9148.9175  
    Iteration 4:   log likelihood = -9148.9073  
    Iteration 5:   log likelihood = -9148.9073  
    
    Mixed-effects GLM                               Number of obs     =     28,099
    Family:                Gaussian
    Link:                  identity
    Group variable:          idcode                 Number of groups  =      4,697
    
                                                    Obs per group:
                                                                  min =          1
                                                                  avg =        6.0
                                                                  max =         15
    
    Integration method: mvaghermite                 Integration pts.  =          7
    
                                                    Wald chi2(6)      =    8365.72
    Log likelihood = -9148.9073                     Prob > chi2       =     0.0000
    -----------------------------------------------------------------------------------
              ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    ------------------+----------------------------------------------------------------
                grade |   .0707903   .0017957    39.42   0.000     .0672708    .0743099
                  age |   .0318439   .0027203    11.71   0.000     .0265122    .0371755
                      |
          c.age#c.age |  -.0006513    .000045   -14.48   0.000    -.0007394   -.0005632
                      |
              ttl_exp |   .0352285   .0011392    30.92   0.000     .0329958    .0374612
               tenure |   .0371336   .0015723    23.62   0.000     .0340519    .0402153
                      |
    c.tenure#c.tenure |  -.0018382   .0001013   -18.15   0.000    -.0020367   -.0016397
                      |
                _cons |   .1472124   .0447254     3.29   0.001     .0595523    .2348726
    ------------------+----------------------------------------------------------------
    idcode            |
            var(_cons)|   .0715801   .0019392                      .0678785    .0754836
    ------------------+----------------------------------------------------------------
        var(e.ln_wage)|   .0853937     .00079                      .0838593    .0869561
    -----------------------------------------------------------------------------------
    LR test vs. linear model: chibar2(01) = 8802.19       Prob >= chibar2 = 0.0000
    
    .
    . estimates store m2
    
    .
    . lrtest m1 m2, force
    
    Likelihood-ratio test                                 LR chi2(2)  =   8802.19
    (Assumption: m1 nested in m2)                         Prob > chi2 =    0.0000
    
    .
    Last edited by Andrew Musau; 18 May 2021, 13:50.

    Comment


    • #3
      Thank you, Andrew Musau !

      Comment

      Working...
      X