Announcement

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

  • Bug? Regress with absorb does not store r(table)

    In Stata 19.5, regress with absorb() does not store r(table). Instead, it lists r(datasignature).

    Code:
    sysuse auto, clear
    reg price mpg, absorb(rep78)
    return list
    Workaround is to just replay the table, but the behavior looks like a bug? The table does get stored without absorb(), and areg does store r(table) as well.

  • #2
    I have the same problem in 19.5. But in 18.5,

    Code:
    . version
    version 18.5
    
    . reg price mpg, absorb(rep78)
    
    Linear regression, absorbing indicators         Number of obs     =         69
                                                    F(1, 63)          =      20.72
                                                    Prob > F          =     0.0000
                                                    R-squared         =     0.2584
                                                    Adj R-squared     =     0.1995
                                                    Root MSE          =     2605.8
    
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             mpg |  -280.2615   61.57666    -4.55   0.000    -403.3126   -157.2103
           _cons |   12112.77   1347.968     8.99   0.000      9419.07    14806.47
    ------------------------------------------------------------------------------
    
    . return list
    
    matrices:
                  r(table) :  9 x 2
    
    . mat list r(table)
    
    r(table)[9,2]
                   mpg       _cons
         b  -280.26149    12112.77
        se   61.576661   1347.9683
         t  -4.5514239   8.9859455
    pvalue    .0000249   6.848e-13
        ll  -403.31262   9419.0701
        ul  -157.21035    14806.47
        df          63          63
      crit   1.9983405   1.9983405
     eform           0           0
    So, yes, it sounds like a bug to me.
    -------------------------------------------
    Richard Williams
    Professor Emeritus of Sociology
    University of Notre Dame
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://academicweb.nd.edu/~rwilliam/

    Comment


    • #3
      Originally posted by Mauricio Caceres View Post
      In Stata 19.5, regress with absorb() does not store r(table). Instead, it lists r(datasignature).

      Code:
      sysuse auto, clear
      reg price mpg, absorb(rep78)
      return list
      Workaround is to just replay the table, but the behavior looks like a bug? The table does get stored without absorb(), and areg does store r(table) as well.
      The -absorb()- option of regress is undocumented, so I doubt you will get official support for it. Among other issues, as this thread shows, it produces incorrect residuals after estimation. I would suggest using areg instead, as it is the official linear regression estimator that absorbs indicators.

      Comment


      • #4
        Dear All,
        I cannot replicate Mauricio's problem with Stata 19.0 upgraded to Stata 19.5:
        Code:
        . sysuse auto, clear
        (1978 automobile data)
        
        . 
        . reg price mpg, absorb(rep78)
        
        Linear regression, absorbing indicators         Number of obs     =         69
                                                        F(1, 63)          =      20.72
                                                        Prob > F          =     0.0000
                                                        R-squared         =     0.2584
                                                        Adj R-squared     =     0.1995
                                                        Root MSE          =     2605.8
        
        ------------------------------------------------------------------------------
               price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
                 mpg |  -280.2615   61.57666    -4.55   0.000    -403.3126   -157.2103
               _cons |   12112.77   1347.968     8.99   0.000      9419.07    14806.47
        ------------------------------------------------------------------------------
        
        . 
        . return list
        
        matrices:
                      r(table) :  9 x 2
        
        . mat list r(table)
        
        r(table)[9,2]
                       mpg       _cons
             b  -280.26149    12112.77
            se   61.576661   1347.9683
             t  -4.5514239   8.9859455
        pvalue    .0000249   6.848e-13
            ll  -403.31262   9419.0701
            ul  -157.21035    14806.47
            df          63          63
          crit   1.9983405   1.9983405
         eform           0           0
        
        
        . areg price mpg, absorb(rep78)
        
        Linear regression, absorbing indicators          Number of obs     =        69
        Absorbed variable: rep78                         No. of categories =         5
                                                         F(1, 63)          =     20.72
                                                         Prob > F          =    0.0000
                                                         R-squared         =    0.2584
                                                         Adj R-squared     =    0.1995
                                                         Root MSE          = 2605.7822
        
        ------------------------------------------------------------------------------
               price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
                 mpg |  -280.2615   61.57666    -4.55   0.000    -403.3126   -157.2103
               _cons |   12112.77   1347.968     8.99   0.000      9419.07    14806.47
        ------------------------------------------------------------------------------
        F test of absorbed indicators: F(4, 63) = 1.072               Prob > F = 0.378
        
        . return list
        
        matrices:
                      r(table) :  9 x 2
        
        . mat list r(table)
        
        r(table)[9,2]
                       mpg       _cons
             b  -280.26149    12112.77
            se   61.576661   1347.9683
             t  -4.5514239   8.9859455
        pvalue    .0000249   6.848e-13
            ll  -403.31262   9419.0701
            ul  -157.21035    14806.47
            df          63          63
          crit   1.9983405   1.9983405
         eform           0           0
        
        .
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Carlo Lazzaro , odd that I can replicate in Stata 19.5 but you can't. When did you last update Stata? I wonder if something got changed in a maintenance release? Also I am on a Win11 machine.

          Code:
          . update query
          (contacting https://www.stata.com)
          
          Update status
              Last check for updates:     22 Nov 2025
              New update available:       none         (as of 22 Nov 2025)
              Current update level:       12 Nov 2025  (what's new)
          
          Possible actions
          
              Do nothing; all files are up to date.
          -------------------------------------------
          Richard Williams
          Professor Emeritus of Sociology
          University of Notre Dame
          StataNow Version: 19.5 MP (2 processor)

          EMAIL: [email protected]
          WWW: https://academicweb.nd.edu/~rwilliam/

          Comment


          • #6
            Dear Richard,
            same update date!
            Code:
            . update query
            (contacting https://www.stata.com)
            
            Update status
                Last check for updates:     22 Nov 2025
                New update available:       none         (as of 22 Nov 2025)
                Current update level:       12 Nov 2025  (what's new)
            
            Possible actions
            
                Do nothing; all files are up to date.
            
            .
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              My 19.5 was updated and it failed to produced r(table).

              Comment


              • #8
                I've just given it another shot (local time: UTC+1.00):
                Code:
                . display "`c(current_time)' `c(current_date)'"
                15:57:20 22 Nov 2025
                
                . use "C:\Program Files\Stata19\ado\base\a\auto.dta"
                (1978 automobile data)
                
                . reg price mpg, absorb(rep78)
                
                Linear regression, absorbing indicators         Number of obs     =         69
                                                                F(1, 63)          =      20.72
                                                                Prob > F          =     0.0000
                                                                R-squared         =     0.2584
                                                                Adj R-squared     =     0.1995
                                                                Root MSE          =     2605.8
                
                ------------------------------------------------------------------------------
                       price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                -------------+----------------------------------------------------------------
                         mpg |  -280.2615   61.57666    -4.55   0.000    -403.3126   -157.2103
                       _cons |   12112.77   1347.968     8.99   0.000      9419.07    14806.47
                ------------------------------------------------------------------------------
                
                . return list
                
                matrices:
                              r(table) :  9 x 2
                
                . mat list r(table)
                
                r(table)[9,2]
                               mpg       _cons
                     b  -280.26149    12112.77
                    se   61.576661   1347.9683
                     t  -4.5514239   8.9859455
                pvalue    .0000249   6.848e-13
                    ll  -403.31262   9419.0701
                    ul  -157.21035    14806.47
                    df          63          63
                  crit   1.9983405   1.9983405
                 eform           0           0
                
                .
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment


                • #9
                  My 19.5 is also updated, I run Windows 10, and it reproduces the problem.

                  Code:
                  . update query
                  (contacting https://www.stata.com)
                  
                  Update status
                      Last check for updates:     22 Nov 2025
                      New update available:       none         (as of 22 Nov 2025)
                      Current update level:       12 Nov 2025  (what's new)
                  
                  Possible actions
                  
                      Do nothing; all files are up to date.
                  
                  . sysuse auto, clear
                  (1978 automobile data)
                  
                  . reg price mpg, absorb(rep78)
                  
                  Linear regression, absorbing indicators         Number of obs     =         69
                                                                  F(1, 63)          =      20.72
                                                                  Prob > F          =     0.0000
                                                                  R-squared         =     0.2584
                                                                  Adj R-squared     =     0.1995
                                                                  Root MSE          =     2605.8
                  
                  ------------------------------------------------------------------------------
                         price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                  -------------+----------------------------------------------------------------
                           mpg |  -280.2615   61.57666    -4.55   0.000    -403.3126   -157.2103
                         _cons |   12112.77   1347.968     8.99   0.000      9419.07    14806.47
                  ------------------------------------------------------------------------------
                  
                  . return list
                  
                  macros:
                        r(datasignature) : "69:3:1885641812:1243663274"

                  Comment


                  • #10
                    as above, my version 19.5 is also up-to-date and I also do not see r(table) in this situation:
                    Code:
                    . update query
                    (contacting https://www.stata.com)
                    
                    Update status
                        Last check for updates:     22 Nov 2025
                        New update available:       none         (as of 22 Nov 2025)
                        Current update level:       12 Nov 2025  (what's new)
                    
                    Possible actions
                    
                        Do nothing; all files are up to date.
                    r; t=1.00 13:51:00
                    
                    . sysuse auto
                    (1978 automobile data)
                    r; t=0.00 13:51:15
                    
                    . reg price mpg, absorb(rep78)
                    
                    Linear regression, absorbing indicators         Number of obs     =         69
                                                                    F(1, 63)          =      20.72
                                                                    Prob > F          =     0.0000
                                                                    R-squared         =     0.2584
                                                                    Adj R-squared     =     0.1995
                                                                    Root MSE          =     2605.8
                    
                    ------------------------------------------------------------------------------
                           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                    -------------+----------------------------------------------------------------
                             mpg |  -280.2615   61.57666    -4.55   0.000    -403.3126   -157.2103
                           _cons |   12112.77   1347.968     8.99   0.000      9419.07    14806.47
                    ------------------------------------------------------------------------------
                    r; t=0.10 13:51:26
                    
                    . return li
                    
                    macros:
                          r(datasignature) : "69:3:1885641812:1243663274"
                    I am using a Mac (Tahoe 26.1)

                    Comment


                    • #11
                      I wonder why Carlo rates. Carlo, do you use Windows or something else?
                      -------------------------------------------
                      Richard Williams
                      Professor Emeritus of Sociology
                      University of Notre Dame
                      StataNow Version: 19.5 MP (2 processor)

                      EMAIL: [email protected]
                      WWW: https://academicweb.nd.edu/~rwilliam/

                      Comment


                      • #12
                        FWIW, in version 17, running on Windows, r(table) is returned:
                        Code:
                        . sysuse auto
                        (1978 automobile data)
                        
                        . regress price mpg, absorb(rep78)
                        
                        Linear regression, absorbing indicators         Number of obs     =         69
                                                                        F(1, 63)          =      20.72
                                                                        Prob > F          =     0.0000
                                                                        R-squared         =     0.2584
                                                                        Adj R-squared     =     0.1995
                                                                        Root MSE          =     2605.8
                        
                        ------------------------------------------------------------------------------
                               price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                        -------------+----------------------------------------------------------------
                                 mpg |  -280.2615   61.57666    -4.55   0.000    -403.3126   -157.2103
                               _cons |   12112.77   1347.968     8.99   0.000      9419.07    14806.47
                        ------------------------------------------------------------------------------
                        
                        . return list
                        
                        matrices:
                                      r(table) :  9 x 2
                        
                        . matrix list r(table)
                        
                        r(table)[9,2]
                                       mpg       _cons
                             b  -280.26149    12112.77
                            se   61.576661   1347.9683
                             t  -4.5514239   8.9859455
                        pvalue    .0000249   6.848e-13
                            ll  -403.31262   9419.0701
                            ul  -157.21035    14806.47
                            df          63          63
                          crit   1.9983405   1.9983405
                         eform           0           0

                        Comment


                        • #13
                          Richard:
                          I use Windows 11 Home.
                          Kind regards,
                          Carlo
                          (Stata 19.0)

                          Comment


                          • #14
                            Unlike xtreg, fe and areg, regress does not officially support option absorb(). Unfortunately, the specified absorb() option is being passed thru to some code that is common between these commands, but regress does not handle the full range of absorb() features and responsibilities that are in areg and xtreg, fe.

                            Given this post and the July 2024 post referenced by Andrew in #3, we will disallow option absorb() in regress in the next Stata update.
                            Last edited by Jeff Pitblado (StataCorp); 24 Nov 2025, 09:38.

                            Comment

                            Working...
                            X