/*This do file generates the Tables and Figures found in Chapter 2 of the text book XXXX */ *Begin by loading in the data Chapter 1 - Example 1 xxx *Generate the log of consumption and income gen ln_i=ln(i) gen ln_c=ln(c) *Label teh variables label variable ln_i "Log of Income" label variable ln_c "Log of Consumption" *Generate a scatter plot of the variables scatter ln_c ln_i *Generate a scatter plot with a linear line of best fit. twoway (scatter ln_c ln_i) (lfit ln_c ln_i) /*Run the regression with ln_c as the dependent variable and ln_i as the independent variable. */ regress ln_c ln_i *Generate c_bar and c_hat egen c_bar=mean(ln_c) predict c_hat, xb *Generate the error term predict e, resid