[Stata Program] use http://www.gseis.ucla.edu/courses/data/surg335 summarize correlate regress y x1 x2 x3 x4 predict p1 predict r1, residual plot y x1 plot y x2 plot y x3 plot y x4 plot r1 x1 plot r1 x2 plot r1 x3 plot r1 x4 plot r1 p1 regress logy x1 x2 x3 x4 predict p2 predict r2, residual plot logy x1 plot logy x2 plot logy x3 plot logy x4 plot r2 x1 plot r2 x2 plot r2 x3 plot r2 x4 plot r2 p2 [Stata Output] summarize Variable | Obs Mean Std. Dev. Min Max ---------+----------------------------------------------------- case | 54 27.5 15.73213 1 54 x1 | 54 5.783333 1.603034 2.6 11.2 x2 | 54 63.24074 16.90253 8 96 x3 | 54 77.11111 21.25378 23 119 x4 | 54 2.744259 1.070356 .74 6.4 y | 54 197.1667 145.2994 34 830 logy | 54 2.206144 .2737845 1.5315 2.9191 correlate (obs=54) | case x1 x2 x3 x4 y logy ---------+--------------------------------------------------------------- case | 1.0000 x1 | -0.0981 1.0000 x2 | 0.0281 0.0901 1.0000 x3 | 0.1149 -0.1496 -0.0236 1.0000 x4 | 0.0616 0.5024 0.3690 0.4164 1.0000 y | -0.0085 0.3725 0.5540 0.5802 0.7223 1.0000 logy | 0.0696 0.3464 0.5929 0.6651 0.7262 0.9131 1.0000 regress y x1 x2 x3 x4 Source | SS df MS Number of obs = 54 ---------+------------------------------ F( 4, 49) = 62.79 Model | 936264.538 4 234066.135 Prob > F = 0.0000 Residual | 182666.962 49 3727.89718 R-squared = 0.8367 ---------+------------------------------ Adj R-squared = 0.8234 Total | 1118931.50 53 21111.9151 Root MSE = 61.057 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- x1 | 33.16383 7.017275 4.726 0.000 19.06209 47.26557 x2 | 4.27186 .5633845 7.582 0.000 3.139696 5.404023 x3 | 4.125738 .5111609 8.071 0.000 3.098522 5.152955 x4 | 14.09156 12.52533 1.125 0.266 -11.07902 39.26215 _cons | -621.5975 64.80043 -9.592 0.000 -751.8189 -491.3762 ------------------------------------------------------------------------------ predict p1 (option xb assumed; fitted values) predict r1, residual plot y x1 830 + | * | | s | u | r | v | i | * v | * a | * l | | * t | * * i | * * * * m | * e | * * * ** | * ** ** * * * | * * * * * * * * ** | **** * * * 34 + * ** * * * +----------------------------------------------------------------+ 2.6 blood clotting score 11.2 plot y x2 830 + | * | | s | u | r | v | i | * v | * a | * l | | * t | ** i | ** * * m | * e | * ** ** | ** * * * ** | * * * * * ** * * * * | * * * * ** * * 34 + ** * * * * +----------------------------------------------------------------+ 8 prognostic index 96 plot y x3 830 + | * | | s | u | r | v | i | * v | * a | * l | | * t | * * i | * * * * m | * e | * * * * ** | * * * ** * * | * * * * ** * * ** * | * * * * *** * 34 + * ** * * * * +----------------------------------------------------------------+ 23 enzyme function test 119 plot y x4 830 + | * | | s | u | r | v | i | * v | * a | * l | | * t | * * i | *** * m | * e | * ** ** | * * *** * * | ** *** ** * * * | * * *** * * * * 34 + * * * * * * * +----------------------------------------------------------------+ .74 liver function test 6.4 plot r1 x1 323.153 + | * | | | | R | e | s | i | d | u | * a | l | * s | * * * * | * * * * * | * ** | * * * * ** * | * ** **** ** **** * * | * * * * * * -80.5226 + * +----------------------------------------------------------------+ 2.6 blood clotting score 11.2 plot r1 x2 323.153 + | * | | | | R | e | s | i | d | u | * a | l | * s | * * * * | * * * * * * | * ** ** * | * ** * * * | * ** * *** ** * * * * | * * ** ** -80.5226 + * +----------------------------------------------------------------+ 8 prognostic index 96 plot r1 x3 323.153 + | * | | | | R | e | s | i | d | u | * a | l | * s | * * * * | * * * * * * | * * * * * * | * ** * * * * * | * * ** ** * **** * ** * | * * * * * -80.5226 + * +----------------------------------------------------------------+ 23 enzyme function test 119 plot r1 x4 323.153 + | * | | | | R | e | s | i | d | u | * a | l | * s | * * * * | * ** ** * | * * * * * | * * ** ** * * * | * ** *** ** *** * * * * | * * * ** -80.5226 + * +----------------------------------------------------------------+ .74 liver function test 6.4 plot r1 p1 323.153 + | * | | | | R | e | s | i | d | u | * a | l | * s | * * * * | * ** * | * ** * * * | ** * * ** * * | * *** ** ***** * * | * * * *** -80.5226 + * +----------------------------------------------------------------+ -90.0293 Fitted values 524.587 regress logy x1 x2 x3 x4 Source | SS df MS Number of obs = 54 ---------+------------------------------ F( 4, 49) = 431.10 Model | 3.86300182 4 .965750454 Prob > F = 0.0000 Residual | .109770615 49 .002240217 R-squared = 0.9724 ---------+------------------------------ Adj R-squared = 0.9701 Total | 3.97277243 53 .07495797 Root MSE = .04733 ------------------------------------------------------------------------------ logy | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- x1 | .0685202 .0054398 12.596 0.000 .0575885 .0794518 x2 | .0092541 .0004367 21.189 0.000 .0083765 .0101318 x3 | .0094745 .0003963 23.910 0.000 .0086782 .0102708 x4 | .0019254 .0097096 0.198 0.844 -.0175868 .0214376 _cons | .4887559 .0502332 9.730 0.000 .3878085 .5897033 ------------------------------------------------------------------------------ predict p2 (option xb assumed; fitted values) predict r2, residual plot logy x1 2.9191 + l | * o | g | ( | * * s | * u | * r | * * * * * v | * * i | * * v | * * * * * * ** a | ** ** * l | * * * * * | * * * * * ** t | ** * i | * * m | * * * * e | * * ) | | 1.5315 + * +----------------------------------------------------------------+ 2.6 blood clotting score 11.2 plot logy x2 2.9191 + l | * o | g | ( | * * s | * u | * r | * * *** v | * * i | * * v | * * * * ** ** a | * * * * * l | * * * * | * * ** * * * * t | * * * * i | * * * m | ** * * e | * * ) | | 1.5315 + * +----------------------------------------------------------------+ 8 prognostic index 96 plot logy x3 2.9191 + l | * o | g | ( | * * s | * u | * r | * * * * * v | * * i | * * v | * * ** ** * a | * * * * l | * * ** * | * * * * * * * * t | * * * * i | * * * m | * * * * e | * * ) | | 1.5315 + * +----------------------------------------------------------------+ 23 enzyme function test 119 plot logy x4 2.9191 + l | * o | g | ( | * * s | * u | * r | ** * * * v | * * i | * * v | * ****** * a | ** * * * l | * * * * * | * ** ** * * * t | * * * * i | * * * m | * * * * e | * * ) | | 1.5315 + * +----------------------------------------------------------------+ .74 liver function test 6.4 plot r2 x1 .139377 + | * | | | * | * R | * e | * s | * i | * d | * u | * * ** a | * * ** *** ** l | * **** * * * * * s | * * * ** * | * * | * * | * | * * * | -.100449 + * * +----------------------------------------------------------------+ 2.6 blood clotting score 11.2 plot r2 x2 .139377 + | * | | | * | * R | * e | * s | * i | * d | * u | * * *** a | * * ** ** ** * l | * * ** **** * * * s | * * *** * * | ** | * * | * | * * * | -.100449 + * * +----------------------------------------------------------------+ 8 prognostic index 96 plot r2 x3 .139377 + | * | | | * | * R | * e | * s | * i | * d | * u | **** ** a | ** * ** * * * * l | * * ** *** * * * * * s | * * * * * * * | ** | * * | * | * * * | -.100449 + * * +----------------------------------------------------------------+ 23 enzyme function test 119 plot r2 x4 .139377 + | * | | | * | * R | * e | * s | * i | * d | * u | * * * *** a | * ** * * * ** * l | * ** * * * * ** * s | * * ** * * | * * | * * | * | * * * | -.100449 + * * +----------------------------------------------------------------+ .74 liver function test 6.4 plot r2 p2 .139377 + | * | | | * | * R | * e | * s | * i | * d | * u | * * * * * a | * * * * * * ** * l | * ** ** * * * * * s | * * ** * * * | ** | * * | * | * * * | -.100449 + * * +----------------------------------------------------------------+ 1.60568 Fitted values 2.86227