UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata FAQ
How can I get an R2 with robust regression (rreg)?

Interestingly enough, Stata's rreg command computes an R-squared, it just doesn't display it. Here is how you can display R-squared, adjusted R-squared, and the RMSE. We will illustrate this using the hsb2 dataset.
use http://www.ats.ucla.edu/stat/stata/notes/hsb2, clear

rreg write female read math

   Huber iteration 1:  maximum difference in weights = .53165996
   Huber iteration 2:  maximum difference in weights = .03680988
Biweight iteration 3:  maximum difference in weights = .15838504
Biweight iteration 4:  maximum difference in weights = .00685531

Robust regression                                      Number of obs =     200
                                                       F(  3,   196) =   65.12
                                                       Prob > F      =  0.0000

------------------------------------------------------------------------------
       write |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      female |   5.395741   .9852906     5.48   0.000     3.452609    7.338873
        read |   .2969854   .0640016     4.64   0.000     .1707651    .4232057
        math |   .4267256   .0699755     6.10   0.000      .288724    .5647271
       _cons |   12.00214   3.016833     3.98   0.000     6.052521    17.95176
------------------------------------------------------------------------------

display "R2 = " e(r2)

R2 = .49918786

display "adjusted R2 = " e(r2_a)

adjusted R2 = .49152237

display "RMSE = " e(rmse)

RMSE = 6.92879

How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California