* create data and graph regression example clear set seed 315 set obs 34 gen y = (uniform()*4) in 1/30 gen x = (4 - (y)) + (uniform()) in 1/30 * change one point replace y = 9 in 31 sum x sca meanx = r(mean) replace x = meanx in 31 * compute the regression reg y x * change two points replace x = 0 in 32 replace x = 5 in 33 * compute predictions predict yhat predict res , res list if y > 5 graph twoway (scatter y x) /// draw a scatter plot of y vs. x (line yhat x), // draw predicted y vs. x graph export 02rgraph1.eps, replace graph twoway (scatter y x) /// draw a scatter plot of y vs. x (line yhat x) /// draw predicted y vs. x (scatter res x, yaxis(2)) /// draw scatter plot res vs. x with (scatteri 9 2.45268 "observation 31", /// msymbol(i) yvarlabel(" ") ) graph export 02rgraph2.eps, replace