# Example 10.2, Effects of Inflation and Deficits on Interest Rates
# Data set: intdef
# Function for result reporting
source("_report.R")
# Load the data and estimate the model 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"
data=ts(data,start=1948,frequency=1)
model=lm(i3.t~inf.t+def.t,data=data)
dig=c(2,3,3,3)
# Describe the model
cat("Model to estimate: 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]),
sep="")
# Report results
{
cat("The estimated regression line is")
reportreg(model,dig,suffix=".hat",adj=T)
}
# Interpretation
cat("The results show that either an increase in inf or an increase in def is predicted to increase i3, e.g. a 1 percentage point increase in inf is predicted to raise i3 by ",
printcoef(model,2,dig[2]), " points. Both independent variables are very statistically significant",
sep="")