Announcement

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

  • estout does not display estadd scalar (Pseudo-R2)

    Dear statlist,
    I try to calculate a pseudo R2 for a mixed effect model and also display it in output (following this thread):

    Code:
    sysuse auto, clear
    eststo clear
    
    * Regular model
    eststo: mixed price c.mpg##c.mpg || foreign:
    scalar llu = e(ll)
    di llu
    
    * Constant only model
    qui mixed price || foreign:
    scalar llr = e(ll)
    di llr
    
    * Computation of the pseudo r2
    estadd scalar pr2 = 1 - llu/llr
    *di "Pseudo-R2: " pr2
    
    ereturn list
    estout, stat(pr2)
    In ereturn list I can see e(pr2) = .0235342435927753. However, in estout the cell for pr2 is empty.

    I have read similar posts on the forum and updated all my addons. The problem remains. Any help would be appreciated. Thank you.

  • #2
    A bit strange why this wouldn't work... I would suggest that you send an email to the author of the program reporting this issue. Meanwhile, you can use the following workaround


    Code:
    sysuse auto, clear
    estimates clear
     
    * Constant only model
    qui mixed price || foreign:
    scalar llr = e(ll)
     
     
    * Regular model
    mixed price c.mpg##c.mpg || foreign:
    scalar llu = e(ll)
     
    * Computation of the pseudo r2
    scalar pr_2 = 1 - llu/llr
     
    ereturn list
    eststo, addscalars(pr2 pr_2)
    
    
    estout, stat(pr2)

    Comment


    • #3
      Hi Andrew,
      Thank you. It works with your method.

      Comment


      • #4
        Just an update on why estadd does not work in #1 (what I wrongly thought was a bug). When specifying this command, you need to make sure that you first store estimates of the regression of interest. Then the workaround in #2 is not needed

        Code:
        sysuse auto, clear
        eststo clear  
        
        * Regular model
        eststo: mixed price c.mpg##c.mpg || foreign:
        scalar llu = e(ll)
        di llu
        
         * Constant only model
        eststo: qui mixed price || foreign:
        scalar llr = e(ll)
        di llr  
        * Computation of the pseudo r2
        estadd scalar pr2 = 1 - llu/llr
        
        *di "Pseudo-R2: " pr2  
        ereturn list
        estout, stat(pr2)
        Last edited by Andrew Musau; 25 Aug 2017, 06:00.

        Comment

        Working...
        X