# Example 12.1, Testing for AR(1) Serial Correlation in the Phillips Curve # Data set: phillips # Function for result reporting source("_report.R") # Load the data and estimate the models in the background load("phillips.Rdata") names(data)[names(data)=="inf"]="inf.t" names(data)[names(data)=="cinf"]="cinf.t" names(data)[names(data)=="unem"]="unem.t" data=ts(data[data$year<=1996,],start=1948,frequency=1) # Refine the data model1=lm(inf.t~unem.t,data=data) model2=lm(cinf.t~unem.t,data=data) dig=c(2,3,3) # Recap the models { cat("This example uses the Phillips curve data set that was used in Examples 10.1 and 11.5", "\nIn Example 10.1, we estimated a static Phillips curve, and the result was") reportreg(model1,dig,suffix=".hat",adj=T) cat("\nIn Example 11.5, we estimated an augmented Phillips curve, and the result was") reportreg(model2,dig,suffix=".hat",adj=T) } # Test for serial correlation { uhat.t=ts(model1$residuals,start=1948,frequency=1) temp=as.data.frame(cbind(uhat.t,uhat.t_1=lag(uhat.t,k=-1))) m1=lm(uhat.t~0+uhat.t_1,data=temp) m1i=lm(uhat.t~uhat.t_1,data=temp) uhat.t=ts(model2$residuals,start=1949,frequency=1) temp=as.data.frame(cbind(uhat.t,uhat.t_1=lag(uhat.t,k=-1))) m2=lm(uhat.t~0+uhat.t_1,data=temp) m2i=lm(uhat.t~uhat.t_1,data=temp) cat("To test for serial correlation, here we estimate an AR(1) model for the residuals for each of the models, i.e. uhat.t = rho * uhat.t_1 + e.t", "\nThe estimation result for the static Phillips curve is") reportreg(m1,c(3,3,3),suffix=".hat",adj=T,intercept=F) cat("\nThe estimation result for the augmented Phillips curve is") reportreg(m2,c(3,3,3),suffix=".hat",adj=T,intercept=F) } # Interpretation cat("For the static curve, the t statistic is ", printt(m1,1,accrte=T), ", which is very strong evidence of positive AR(1) serial correlation. This makes the standard errors and t statistic in Example 10.1 invalid.", "\nFor the augmented curve, the t statistic is ", printt(m2,1,accrte=T,tdig=3), ", and there is no evidence of AR(1) serial correlation", "\nThe above results are based on the regressions without intercepts. If we add an intercept to the AR(1) model, the rhohats for the two cases are still ", printcoef(m1i,2,3), " and ", printcoef(m2i,2,3), " after rounded to 3 decimal places, and the t statistics change slightly to ", printt(m1i,2,accrte=T), " and ", printt(m2i,2,accrte=T,tdig=3), ", respectively. This set of estimates and statistics are consistent with those in the textbook", sep="")