UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata Textbook Examples
Applied Linear Statistical Models by Neter, Kutner, et. al.
Chapter 3: Diagnostics and Remedial Measures

Inputting the Toluca Company data.
input x y
   80  399
   30  121
   50  221
   90  376
   70  361
   60  224
  120  546
   80  352
  100  353
   50  157
   40  160
   70  252
   90  389
   20  113
  110  435
  100  420
   30  212
   50  268
   90  377
  110  421
   30  273
   90  468
   40  244
   80  342
   70  323
end

label var x "lot size"
label var y "work hrs"

Figure 2.2 on page 51.

reg y x

      Source |       SS       df       MS              Number of obs =      25
-------------+------------------------------           F(  1,    23) =  105.88
       Model |  252377.581     1  252377.581           Prob > F      =  0.0000
    Residual |  54825.4592    23  2383.71562           R-squared     =  0.8215
-------------+------------------------------           Adj R-squared =  0.8138
       Total |   307203.04    24  12800.1267           Root MSE      =  48.823

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   3.570202   .3469722    10.29   0.000     2.852435    4.287969
       _cons |   62.36586   26.17743     2.38   0.026     8.213711     116.518
------------------------------------------------------------------------------
90% CI for beta0, page 54.
regress y x, level(90)


      Source |       SS       df       MS              Number of obs =      25
-------------+------------------------------           F(  1,    23) =  105.88
       Model |  252377.581     1  252377.581           Prob > F      =  0.0000
    Residual |  54825.4592    23  2383.71562           R-squared     =  0.8215
-------------+------------------------------           Adj R-squared =  0.8138
       Total |   307203.04    24  12800.1267           Root MSE      =  48.823

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [90% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   3.570202   .3469722    10.29   0.000     2.975536    4.164868
       _cons |   62.36586   26.17743     2.38   0.026      17.5011    107.2306
------------------------------------------------------------------------------
Confidence intervals X = 100, pages 60 & 65.
set obs 26
replace x = 100 in 26
regress y x in 1/25

predict yhat2
predict stdf, stdf
predict stdp, stdp
generate ll1 = yhat2 - 1.714*stdp
generate ul1 = yhat2 + 1.714*stdp
generate ll2 = yhat2 - 1.714*stdf
generate ul2 = yhat2 + 1.714*stdf

list ll1 ul1 ll2 ul2 in 26

           ll1        ul1        ll2        ul2
 26.  394.9233   443.8488   332.2006   506.5715
Figre 2.6, page 69.
graph twoway (lfitci y x, level(90)  ciplot(rline) )
Example of correlation coefficient and R-squared, page 82.
corr y x

(obs=25)

             |        y        x
-------------+------------------
           y |   1.0000
           x |   0.9064   1.0000

regress y x

      Source |       SS       df       MS              Number of obs =      25
-------------+------------------------------           F(  1,    23) =  105.88
       Model |  252377.581     1  252377.581           Prob > F      =  0.0000
    Residual |  54825.4592    23  2383.71562           R-squared     =  0.8215
-------------+------------------------------           Adj R-squared =  0.8138
       Total |   307203.04    24  12800.1267           Root MSE      =  48.823

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   3.570202   .3469722    10.29   0.000     2.852435    4.287969
       _cons |   62.36586   26.17743     2.38   0.026     8.213711     116.518
------------------------------------------------------------------------------

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.