# Example 10.8, Fertility Equation
# Data set: fertil3
# Function for result reporting
source("_report.R")
# Load the data and estimate the models in the background
load("fertil3.Rdata")
names(data)[names(data)=="gfr"]="gfr.t"
names(data)[names(data)=="pe"]="pe.t"
names(data)[names(data)=="ww2"]="ww2.t"
names(data)[names(data)=="pill"]="pill.t"
data=ts(data,start=1913,frequency=1)
model0=lm(gfr.t~pe.t+ww2.t+pill.t,data=data)
model1=lm(gfr.t~pe.t+ww2.t+pill.t+t,data=data)
model2=lm(gfr.t~pe.t+ww2.t+pill.t+t+tsq,data=data)
dig0=c(2,3,2,2,3)
dig1=c(2,3,2,3,2,3)
dig2=c(2,3,2,2,2,4,3)
# Recap model
{
cat("This example closely follows Example 10.4. The estimation results in the previous example were")
reportreg(model0,dig0,suffix=".hat",adj=T)
}
# Estimate first model
{
cat("Adding a linear time trend into the model gives")
reportreg(model1,dig1,suffix=".hat",adj=T)
}
# Interpretation
cat("The estimate on pe is now much larger in magnitude and statistically significant. On the other hand, while pill has a significant negative effect in the original model, it now has a positive sign and is no longer significant. The coefficient on t suggests that gfr on average had a downward trend over the period")
# Estimate second model
{
cat("Since gfr exhibited both upward and downward trends during the period, we now add a quadratic time trend. The estimation results are")
reportreg(model2,dig2,suffix=".hat",adj=T)
}
# Estimate the FDL model
{
cat("Expecting gfr to react to changes in pe with a lag, we further estimate a distributed lag model with two lags. The estimated regression line is")
reportreg(model2,dig2,suffix=".hat",adj=T)
}
# Interpretation
cat("This time, the coefficient on pe is even larger and more statistically significant, and pill regains the expected negative effect and is marginally significant. Both trend terms are significant. The quadratic trend is a flexible way to account for the unusual trending behavior of gfr")