Announcement

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

  • F-statistic in linear regression output different from anova output

    Could someone tell me why, in the example below, the F-statistic in the regression table is not the same to that reported by -anova-? Thanks!

    Code:
    . reg peerlnval d_res
    
          Source |       SS           df       MS      Number of obs   =  14018721
    -------------+----------------------------------   F(1, 14018719)  >  99999.00
           Model |  27520.0312         1  27520.0312   Prob > F        =    0.0000
        Residual |  3190557.84  14018719  .227592681   R-squared       =    0.0086
    -------------+----------------------------------   Adj R-squared   =    0.0086
           Total |  3218077.87  14018720  .229555756   Root MSE        =    .47707
    
    ------------------------------------------------------------------------------
       peerlnval | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           d_res |   .0889601   .0002558   347.73   0.000     .0884587    .0894615
           _cons |   6.327299   .0001887  3.4e+04   0.000     6.326929    6.327669
    ------------------------------------------------------------------------------
    
    . anova peerlnval d_res
    
                             Number of obs = 14,018,721    R-squared     =  0.0086
                             Root MSE      =    .477067    Adj R-squared =  0.0086
    
                      Source | Partial SS         df         MS        F    Prob>F
                  -----------+----------------------------------------------------
                       Model |  27520.031          1   27520.031   1.2e+05  0.0000
                             |
                       d_res |  27520.031          1   27520.031   1.2e+05  0.0000
                             |
                    Residual |  3190557.8 14,018,719   .22759268  
                  -----------+----------------------------------------------------
                       Total |  3218077.9 14,018,720   .22955576  
    
    .

  • #2
    F(1, 14018719) > 99999.00
    Therefore:

    Code:
    assert 1.2e+05>99999
    Res.:

    Code:
    . assert 1.2e+05>99999
    
    .
    To see the actual value, try

    Code:
    display e(F)
    after regress.

    Comment


    • #3
      Paula:
      -anova- assumes that predictors are categorical, unless otherwise stated (that is, unless the -c.- prefix is imposed):
      Code:
      . use "C:\Program Files\Stata17\ado\base\a\auto.dta"
      (1978 automobile data)
      
      . sysuse auto.dta
      (1978 automobile data)
      
      . regress price mpg
      
            Source |       SS           df       MS      Number of obs   =        74
      -------------+----------------------------------   F(1, 72)        =     20.26
             Model |   139449474         1   139449474   Prob > F        =    0.0000
          Residual |   495615923        72  6883554.48   R-squared       =    0.2196
      -------------+----------------------------------   Adj R-squared   =    0.2087
             Total |   635065396        73  8699525.97   Root MSE        =    2623.7
      
      ------------------------------------------------------------------------------
             price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
      -------------+----------------------------------------------------------------
               mpg |  -238.8943   53.07669    -4.50   0.000    -344.7008   -133.0879
             _cons |   11253.06   1170.813     9.61   0.000     8919.088    13587.03
      ------------------------------------------------------------------------------
      
      . anova price mpg
      
                               Number of obs =         74    R-squared     =  0.5963
                               Root MSE      =    2199.46    Adj R-squared =  0.4439
      
                        Source | Partial SS         df         MS        F    Prob>F
                    -----------+----------------------------------------------------
                         Model |  3.787e+08         20    18933575      3.91  0.0000
                               |
                           mpg |  3.787e+08         20    18933575      3.91  0.0000
                               |
                      Residual |  2.564e+08         53   4837620.7  
                    -----------+----------------------------------------------------
                         Total |  6.351e+08         73     8699526  
      
      
      . anova price c.mpg
      
                               Number of obs =         74    R-squared     =  0.2196
                               Root MSE      =    2623.65    Adj R-squared =  0.2087
      
                        Source | Partial SS         df         MS        F    Prob>F
                    -----------+----------------------------------------------------
                         Model |  1.394e+08          1   1.394e+08     20.26  0.0000
                               |
                           mpg |  1.394e+08          1   1.394e+08     20.26  0.0000
                               |
                      Residual |  4.956e+08         72   6883554.5  
                    -----------+----------------------------------------------------
                         Total |  6.351e+08         73     8699526
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        Thanks so much!

        Comment

        Working...
        X