# Example 12.6, Differencing the Interest Rate Equation
# Data set: intdef
# Function for result reporting
source("_report.R")
# Load the data and estimate the models in the background
load("intdef.Rdata")
names(data)[names(data)=="i3"]="i3.t"
names(data)[names(data)=="inf"]="inf.t"
names(data)[names(data)=="def"]="def.t"
names(data)[names(data)=="ci3"]="ci3.t"
names(data)[names(data)=="cinf"]="cinf.t"
names(data)[names(data)=="cdef"]="cdef.t"
tsdata=ts(data,start=1948,frequency=1)
model0=lm(i3.t~inf.t+def.t,data=tsdata)
model1=lm(ci3.t~cinf.t+cdef.t,data=tsdata)
dig0=c(2,3,3,3)
dig1=c(3,3,3,3)
# Recap the model
{
cat("This example uses the T-bill rate data set that was used in Example 10.2. In the previous example, we estimated the model: i3.t = beta0 + beta1 * inf.t + beta2 * def.t + u.t",
"\nwhere i3 is ", paste(desc[desc[,1]=="i3",2]),
"\ninf is ", paste(desc[desc[,1]=="inf",2]),
"\nand def is ", paste(desc[desc[,1]=="def",2]),
"\nThe regression result was",
sep="")
reportreg(model0,dig0,suffix=".hat",adj=T)
}
# Report the first-differenced model
uhat.t=ts(model0$residuals,start=1948,frequency=1)
res=cbind(uhat.t,uhat.t_1=lag(uhat.t,k=-1))
mres=lm(uhat.t~uhat.t_1,data=res)
{
cat("\nRegressing the residuals from the above equation on its first lag gives a slope coefficient rhohat = ",
printcoef(mres,2,3), " (", printse(mres,2,3), "), which is large and very statistically significant. Therefore, we want to correct for the serial correlation problem. To do so, we estimate another model, using the first differenced dependent and independent variables, ci3, cinf and cdef. The estimated regression line is",
sep="")
reportreg(model1,dig1,suffix=".hat",adj=T)
}
# Interpretation
uhat.t=ts(model1$residuals,start=1949,frequency=1)
res=cbind(uhat.t,uhat.t_1=lag(uhat.t,k=-1))
mres=lm(uhat.t~uhat.t_1,data=res)
cat("The coefficients from both regressions are very different, suggesting either lack of strictly exogeneity or unit root behavior. In fact, the correlation between i3.t and i3.t_1 is ",
round(cor(data$i3.t,data$i3_1,use="complete.obs"),3), ", which may indicate a problem with meaningfully interpreting the first regression",
"\nThe second equation has essentially no serial correlation: regressing the residuals on its first lag gives a rhohat = ",
printcoef(mres,2,3), " (", printse(mres,2,3), "). Because first differencing eliminates possible unit roots as well as serial correlation, the second equation is probably of higher interpretive value. As it suggests, changes in inf are only weakly, positively related to changes in inf, and the effect of changes in def is actually negative and statistically very insignificant",
sep="")