Linear Statistical Models: Regression

Comparing Regression Models

Updated for Stata 11


F-test Comparing Two Models

  • Let k1 > k2.

    R2y.12...k1 has all of the same variables as R2y.12...k2 plus more additional variables. Thus, R2y.12...k1 can be said to be nested in R2y.12...k2. The denominator always contains (1 - R2y.12...k1) for the model with more variables.

    An Example Using hsbdemo

    First model includes read math science socst female & ses.

    use http://www.philender.com/courses/data/hsbdemo, clear
    
    regress write read math science socst i.female i.ses
    
          Source |       SS       df       MS              Number of obs =     200
    -------------+------------------------------           F(  7,   192) =   41.70
           Model |  10784.7713     7  1540.68161           Prob > F      =  0.0000
        Residual |  7094.10375   192   36.948457           R-squared     =  0.6032
    -------------+------------------------------           Adj R-squared =  0.5887
           Total |   17878.875   199   89.843593           Root MSE      =  6.0785
    
    ------------------------------------------------------------------------------
           write |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
            read |   .1237858   .0652878     1.90   0.059    -.0049876    .2525593
            math |   .2383564   .0673903     3.54   0.001      .105436    .3712768
         science |   .2453025   .0610984     4.01   0.000     .1247923    .3658127
           socst |   .2348613   .0540357     4.35   0.000     .1282815     .341441
        1.female |   5.386751    .888778     6.06   0.000     3.633728    7.139774
                 |
             ses |
              2  |  -.9670662   1.119495    -0.86   0.389    -3.175154    1.241022
              3  |  -.6221902   1.292749    -0.48   0.631    -3.172004    1.927623
                 |
           _cons |   6.438565   2.883858     2.23   0.027     .7504525    12.12668
    ------------------------------------------------------------------------------

    Second model includes all of the above variables except for read female & ses.

    regress write math science socst
    
    
          Source |       SS       df       MS              Number of obs =     200
    -------------+------------------------------           F(  3,   196) =   69.36
           Model |  9206.56411     3   3068.8547           Prob > F      =  0.0000
        Residual |  8672.31089   196  44.2464841           R-squared     =  0.5149
    -------------+------------------------------           Adj R-squared =  0.5075
           Total |   17878.875   199   89.843593           Root MSE      =  6.6518
    
    ------------------------------------------------------------------------------
           write |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
            math |   .2887075   .0696839     4.14   0.000      .151281    .4261339
         science |    .221637   .0624744     3.55   0.000     .0984286    .3448454
           socst |   .3017268   .0533039     5.66   0.000     .1966039    .4068496
           _cons |   10.27213   3.002846     3.42   0.001      4.35009    16.19416
    ------------------------------------------------------------------------------

    Manual Arithmetic

    
        (R2y.12...k1 - R2y.12...k2)/(k1 - k2)
    F = -----------------------------------
        (1 - R2y.12...k1)/(N - k1 - 1)
        
        (.6032 - .5149)/(7-3)         .0883/4      .022075
      = ------------------------  =  --------- = ---------- = 10.681452
        (1 - .6032)/(200 - 7 -1)     .3968/192    .00206667
        
    with df = (k1 -k2) & (N - k1 -1) = 3 & 193    
    

    Using Stata

    regress write read math science socst i.female i.ses
    
          Source |       SS       df       MS              Number of obs =     200
    -------------+------------------------------           F(  7,   192) =   41.70
           Model |  10784.7713     7  1540.68161           Prob > F      =  0.0000
        Residual |  7094.10375   192   36.948457           R-squared     =  0.6032
    -------------+------------------------------           Adj R-squared =  0.5887
           Total |   17878.875   199   89.843593           Root MSE      =  6.0785
    
    ------------------------------------------------------------------------------
           write |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
            read |   .1237858   .0652878     1.90   0.059    -.0049876    .2525593
            math |   .2383564   .0673903     3.54   0.001      .105436    .3712768
         science |   .2453025   .0610984     4.01   0.000     .1247923    .3658127
           socst |   .2348613   .0540357     4.35   0.000     .1282815     .341441
        1.female |   5.386751    .888778     6.06   0.000     3.633728    7.139774
                 |
             ses |
              2  |  -.9670662   1.119495    -0.86   0.389    -3.175154    1.241022
              3  |  -.6221902   1.292749    -0.48   0.631    -3.172004    1.927623
                 |
           _cons |   6.438565   2.883858     2.23   0.027     .7504525    12.12668
    ------------------------------------------------------------------------------
    
    testparm read i.female i.ses
    
     ( 1)  read = 0
     ( 2)  1.female = 0
     ( 3)  2.ses = 0
     ( 4)  3.ses = 0
    
           F(  4,   192) =   10.68
                Prob > F =    0.0000


    Linear Statistical Models Course

    Phil Ender, 24sep10, 14jan00