# Example 10.6, Election Outcomes and Economic Performance
# Data set: fair
# Function for result reporting
source("_report.R")
# Load the data and estimate the model in the background
load("fair.Rdata")
names(data)[names(data)=="pWHgnews"]="partyWH.gnews"
names(data)[names(data)=="pWHinf"]="partyWH.inf"
tsdata=ts(data[-21,],start=1916,frequency=.25) # Data is refined here
model=lm(demvote~partyWH+incum+partyWH.gnews+partyWH.inf,data=tsdata)
dig=c(3,4,4,4,4,3)
# Describe the model
cat("The data set contains data about the U.S. presidential election results from 1916 to 1996. For the following regression, we leave out the observation in 1996 and use the first 20 observation",
"\nModel to estimate: demvote = beta0 + beta1 * partyWH + beta2 * incum + beta3 * partyWH.gnews + beta4 * partyWH.inf + u",
"\nwhere demvote is ", paste(desc[desc[,1]=="V",2]),
"\npartyWH is ", paste(desc[desc[,1]=="I",2]),
"\nincum is ", paste(desc[desc[,1]=="DPER",2]), ", =1 if Dem incumbent is running, -1 if Rep incumbent is running",
"\ngnews is ", paste(desc[desc[,1]=="n",2]),
"\ninf is ", paste(desc[desc[,1]=="p15",2]),
"\nand partyWH.gnews and partyWH.inf are two interaction terms",
sep="")
# Report results
{
cat("The estimated regression line is")
reportreg(model,dig,adj=T)
}
# Interpretation
cat("All independent variables, except partyWH, are statistically significant at the 5% level. incum was on average worth ",
100*as.numeric(printcoef(model,3,dig[3])), " percentage points in the share of the vote",
"\nSince partyWH = 1 when a Democrat is in the White House, beta3 and beta4 measure the effect of good news and inflation on the party in power. As the estimates imply, gnews has a positive effect: an increase of one quarter in gnews was on average worth ",
100*as.numeric(printcoef(model,4,dig[4])), " percentage points; on the other hand, an increase of 1 percentage point in inf on average cost the party in power ",
100*as.numeric(printabscoef(model,5,dig[5])), " percentage points of the vote",
"\nWe could have used this equation to predict the outcome of the 1996 presidential election between Bill Clinton, the Democrat, and Bob Dole, the Republican. Because Clinton ran as an incumbent, partyWH = 1 and incum = 1. With gnews = ",
data[21,"gnews"], " and inf = ", data[21,"inf"], ", the predicted proportion of vote that goes to Clinton is ",
printcoef(model,1,dig[1]), " - ", printabscoef(model,2,dig[2]), " + ", printcoef(model,3,dig[3]), " + ", printcoef(model,4,dig[4]), "(", data[21,"gnews"], ") - ", printabscoef(model,5,dig[5]), "(", data[21,"inf"], ") = ",
100*round(as.numeric(printcoef(model,1,dig[1]))+as.numeric(printcoef(model,2,dig[2]))+as.numeric(printcoef(model,3,dig[3]))+as.numeric(printcoef(model,4,dig[4]))*data[21,"gnews"]+as.numeric(printcoef(model,5,dig[5]))*data[21,"inf"],4), "%. Actually, Clinton won with a share of 54.65%",
sep="")