### Stata Textbook Examples Applied Regression Analysis by John Fox Chapter 6: Statistical Inference for Regression

The bottom of page 117 and top of page 118 illustrates how you can get standard errors for a and b and form confidence intervals for a and b.
First, we use the davis file and keep just the women.
use http://www.ats.ucla.edu/stat/stata/examples/ara/davis if female == 0, clear
(From Fox, Applied Regression Analysis.  Use 'notes' command for source of data )
generate t = measwt if subject==12
replace measwt = measht if subject==12
replace measht = t if subject==12
drop t
Now we run the regression predicting measwt from reptwt. The regression table below shows the Se(A) is 1.744, and the Se(B) is .0305, as shown at the bottom of page 117. The regression table also gives us the confidence interval for A (-1.68378 to 5.238787) and the Confidence interval for B (.9166458 to 1.037803) as shown at the bottom of page 118.
regress measwt reptwt

Source |       SS       df       MS                  Number of obs =     101
---------+------------------------------               F(  1,    99) = 1024.54
Model |  4334.88935     1  4334.88935               Prob > F      =  0.0000
Residual |  418.873025    99  4.23104066               R-squared     =  0.9119
Total |  4753.76238   100  47.5376238               Root MSE      =  2.0569

------------------------------------------------------------------------------
measwt |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
reptwt |   .9772242   .0305301     32.009   0.000       .9166458    1.037803
_cons |   1.777503   1.744408      1.019   0.311       -1.68378    5.238787
------------------------------------------------------------------------------
Page 122 shows how to get confidence intervals in a multiple regression, analyzing the duncan prestige data file. We first use the data file.
use http://www.ats.ucla.edu/stat/stata/examples/ara/duncan, clear
(From Fox, Applied Regression Analysis.  Use 'notes' command for source of data)
If we run the regression predicting prestige from educ and income, we see that Stata gives us the estimate for the coefficients for educ and income, as well as confidence intervals that correspond to the values shown on page 122.
regress prestige educ income

Source |       SS       df       MS                  Number of obs =      45
---------+------------------------------               F(  2,    42) =  101.22
Model |  36180.9458     2  18090.4729               Prob > F      =  0.0000
Residual |  7506.69865    42   178.73092               R-squared     =  0.8282
Total |  43687.6444    44   992.90101               Root MSE      =  13.369

------------------------------------------------------------------------------
prestige |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
educ |   .5458339   .0982526      5.555   0.000       .3475521    .7441158
income |   .5987328   .1196673      5.003   0.000       .3572343    .8402313
_cons |  -6.064663   4.271941     -1.420   0.163      -14.68579    2.556463
------------------------------------------------------------------------------
Page 123, shows a Test of All Slopes that tests the hypothesis that all of the slopes (coefficients) are 0. Stata provides this test in the top right portion of the regression table above. In fact, you can see that the Analysis of Variance table from the bottom of page 123 corresponds to the top left and top right portion of the Stata output above.
Page 125 shows how you can test whether a subset of the slopes are equal to 0.  Fox shows how to test whether the coefficient for educ is significantly different from 0.  You can inspect the regression table above and look at the t value and P>|t| value from the table to see that the t value is 5.556 and the p value is 0.000 indicating that the coefficient for educ is significantly different from 0.  Had you wanted to test 2 or more coefficients, then you could use the test command as illustrated below.  As you see, the test command gives an F test that corresponds to the value shown on page 125.
test educ

( 1)  educ = 0.0

F(  1,    42) =   30.86
Prob > F =    0.0000

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.