Prediction: Elections and Regression

Published

October 4, 2022

This content is from Fall 2022. Go to Fall 2023 site

Readings

  • For prediction and loops, see QSS 4.1 (you can skip 4.1.1)
  • For regression, see either MD Ch 5 or QSS 4.2 (you can skip 4.2.5).

Data

  • Reinstall the Gov 50 data package that has new data for this week:
remotes::install_github("mattblackwell/gov50data")
library(tidyverse)
polls20 <- read_csv("polls20.csv")
pres20 <- read_csv("pres20.csv")
national_polls20 <- read_csv("national_polls20.csv")
  • You may need to install the lubridate package if it’s not installed:
install.packages("lubridate")
  • For Thursday, you may want to reinstall the gov50date package and install the broom package:
install.packages("broom")

Slides and Code