/*This do file generates the Tables and Figures found in Chapter 10 of the text book XXXX */ *Begin by loading in the data Chapter 10 - Example 1 xxx *Set the data as time series tsset year label variable year "Year" *Put the variables in logs gen ln_i=ln(i) gen ln_c=ln(c) /*Run the regression with consumption as the dependent variable and income as the independent variable */ regress ln_c ln_i /*Obtain the error terms from the model */ predict ehat, resid label variable ehat "Error Terms" /*Generate a scatter plot of residuals over time to identify if a pattern is present */ scatter ehat year *Perform the Breusch-Godfrey (BG) test regress ehat ln_i L.ehat *Perform the first difference estimation regress D.ln_c D.ln_i /*Find the value for rho */ regress ehat L.ehat scalar rho=_b[L.ehat] /*Implement the GLS transformation */ gen ln_i_ast=ln_i-rho*L.ln_i gen ln_c_ast=ln_c-rho*L.ln_c gen beta0_ast=1 replace beta0_ast=beta0_ast-rho*beta0_ast regress ln_c_ast beta0_ast ln_i_ast, nocons