--------------------------------------------------------------------------------

      name:  <unnamed>

       log:  C:\Documents and Settings\Michael Rosenfeld\My Documents\newer web

> pages\soc_meth_proj3\fall_2011_381_logs\class11.log

  log type:  text

 opened on:  27 Oct 2011, 12:14:15

 

* Some quick stata graphing routines, you won't be able to see or appreciate the output unless you run these yourself (since this log file doesn't have the graphics embedded in it).

 

. *(8 variables, 11 observations pasted into data editor)

 

. twoway (scatter y2 x2) (lfit y2 x2)

*scatter plot plus the best fit line overlaid.

 

. regress y2 x2

 

      Source |       SS       df       MS              Number of obs =      11

-------------+------------------------------           F(  1,     9) =   17.97

       Model |  27.5000024     1  27.5000024           Prob > F      =  0.0022

    Residual |   13.776294     9  1.53069933           R-squared     =  0.6662

-------------+------------------------------           Adj R-squared =  0.6292

       Total |  41.2762964    10  4.12762964           Root MSE      =  1.2372

 

------------------------------------------------------------------------------

          y2 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]

-------------+----------------------------------------------------------------

          x2 |         .5   .1179638     4.24   0.002     .2331475    .7668526

       _cons |   3.000909   1.125303     2.67   0.026     .4552978     5.54652

------------------------------------------------------------------------------

 

*The regression that makes that best fit line

 

. predict m2

(option xb assumed; fitted values)

 

. gen resid_m2=y2-m2

*generate residuals

 

. twoway (scatter resid_m2 x2)

* plot the residuals against X

 

. rvfplot, yline(0)

 

* a built-in post estimation command to plot residuals versus fitted values.

 

. twoway (scatter y2 x2) (lfit y2 x2) (line y2 m2)

* Note that the above graph produced a weird result because the X's are not sorted, and connected the points via a line made a mess.

 

. twoway (scatter y2 x2) (lfit y2 x2) (line m2 x2, sort)

* This was better.

-----------------------------