/*************************************************************** ECO304 Example Topic 5: Multiple Regression Model ****************************************************************/ /* a simple random variable called mars generated and compare the R square between with/without it */ clear all set seed 12345678 use https://bigblue.depaul.edu/jlee141/econdata/eco304/wage1 * Multiple Regression Model regr wage educ exper * Generate a random variable gen mars = rnormal(0,1) * Multiple Regression with Mars regr wage educ exper mars * Multiple Regression with tenure regr wage educ exper tenure * One time Installation of estout package for regresion table ssc install estout * Summary Table for Regression Models reg wage educ exper eststo r1 reg wage educ exper mars eststo r2 reg wage educ exper tenure eststo r3 esttab r1 r2 r3, r2 ar2 * Retricted F test Ho: b2=b3 =0 reg wage educ reg wage educ exper tenure test exper tenure * Manual Calculation of Restricted F Statistic display [(5980.68 - 4966.30)/2]/[4966.30/522] * Residuals Comparison for three models quietly regr wage educ predict ei1, resid quietly regr wage educ exper predict ei2, resid quietly regr wage educ exper tenure predict ei3, resid * Summary Stat for the residuals sum ei* hist ei1, normal bin(16) saving(ei1, replace) hist ei2, normal bin(16) saving(ei2, replace) hist ei3, normal bin(16) saving(ei3, replace) graph combine ei1.gph ei2.gph ei3.gph, xcommon col(1) ycommon