# Statistics and Statistical Programming (Winter 2021)/Problem set 14

This problem set asks you to apply, extend, and interpret the widely influential "bread and peace" model of U.S. electoral behavior from the work of Douglas Hibbs. In brief, Hibbs argues that two variables almost perfectly predict U.S. presidential election vote-share for incumbent party candidates since 1950: economic growth and U.S. military fatalities (both calculated over the duration of the previous president's term). Since we're doing univariate (one predictor variable) regression this week, I ask you to work with the income measure (predictor) and the incumbent part vote share (outcome).

## Programming challenges[edit]

### PC1 Import and update data[edit]

Data for all U.S. presidential elections 1952-2012 are available here. Note that this points to a ".dat" file, which in this case is just a raw text file format that you can import using the following command: `read.table(url(<insert.url.here>), header=TRUE)`

. (inserting the URL for the dataset in the appropriate spot).

Each row corresponds to one presidential election since 1952. The variables provided are:

`year`

The year of the presidential election.`growth`

Economic growth during the preceding four years (increase in per-capita income).`vote`

Proportion of the popular vote won by the incumbent party candidate.`inc_party_candidate`

Incumbent party candidate.`other_candidate`

Out-party candidate.

The dataset does not include 2016 or 2020 so lets add 2016 by hand. You will likely recall that Hillary Clinton was the incumbent party candidate and Donald Trump was the out-party candidate that year. Clinton won approximately 51.1% of the popular vote and a reasonable estimate for per-capita income growth 2012-2016 is 2.2%.

You can append the row for the 2016 election to the imported dataset in a bunch of different ways. (I would personally do so using a call to `list()`

nested inside a call to `rbind()`

(e.g., `rbind(<hibbs_data>, list(<2016 row>))`

). You could also explore the `add_row()`

function in the tidyverse. As usual, your mileage may vary.)

### PC2 Summarize and visualize data[edit]

You should be familiar with how to do this by now. Make sure to include a scatterplot of `growth`

against `vote`

.

### PC3 Calculate covariance and correlation[edit]

Calculate the covariance and correlation of `growth`

and `vote`

.

See this week's R tutorial for example commands here and the Wikipedia articles on correlation and covariance for details about the underlying calculations.

### PC4 Fit and summarize a linear model[edit]

Use the `lm()`

function to fit a least squares regression of economic growth on incumbent party vote share. Use the `summary()`

function to present a summary of the model results.

### PC5 Assess the model fit[edit]

Evaluate the conditions for least squares regression (linearity, normal residuals, constant variability, independent observations). Wherever possible, present plots and/or calculations to support your evaluations. In particular, you probably want to produce the following (examples provided in this week's R tutorial): (a) a histogram of the residuals (b) a plot of the residuals against the (sequential) values of X (c) a quantile-quantile plot

### PC6 Calculate confidence interval for a coefficient[edit]

The very last part of `OpenIntro` §8 provides detailed instructions for estimating a confidence interval around a regression coefficient. Please calculate the confidence interval for the coefficient on `growth`

from the results of your regression model.

### PC7 Calculate an out-of-sample prediction and 95% prediction interval[edit]

What was/is the predicted vote share for Donald Trump in 2020 based on this model? The online supplement to `OpenIntro` §8 assigned this week provides detailed examples for how to produce a out-of-sample prediction from a regression model. Please calculate the point estimate and 95% prediction interval for the incumbent party candidate's share of the vote in 2020 given that (a reasonable estimate of) the per-capita income growth 2016-2020 is 2.5%.

## Statistical questions[edit]

The questions below refer to the univariate regression analysis you completed in the programming challenges above.

### SQ1 Describe and interpret the results[edit]

Do this for any/all of the analysis you conducted in the programming challenges. In particular, be sure to:

- address any noteworthy observations from the descriptive summaries and plots
- summarize the regression results effectively (including the coefficients and value).
- summarize the confidence interval around the estimate for
`growth`

that you calculated. - provide a substantive interpretation of the results in terms of the variables/concepts included in the analysis.

### SQ2 Discuss regression diagnostics[edit]

Describe the regression diagnostics and whether the conditions necessary to identify a least-squares fit seem to apply. If there are violations of these assumptions/conditions, consider how that might bias the results.

### SQ3 Disambiguate: correlation vs. covariance vs. OLS estimate[edit]

You characterized the relationship between `growth`

and `vote`

in three different ways. What do you make of each of these? What are the similarities and differences between them?

### SQ4 Interpret out-of-sample prediction[edit]

Discuss and interpret the out-of-sample prediction you calculated for Trump's vote share in 2020. Trump received about 46.9% of the popular vote. How does this observed value relate to your prediction? How do you interpret this relationship?

### SQ5 Revisit (vaguely stated) theory[edit]

Insofar as we've only considered one part of the "bread and peace" theory here, how would you interpret your results in light of the prior theory/findings as described at the beginning of the problem set? Any confounding factors not present in the original theory/models that you think might be important to include? Why would you argue to include them (or not)?