---
title: "Lecture 5 Exercises"
author: "Your Name"
output: html_document
---
```{r setup, message = FALSE, warning = FALSE, echo=FALSE}
knitr::opts_chunk$set(message = FALSE, warning = FALSE, dev="svg", tidy=TRUE,  tidy.opts = list(only.comment=TRUE,  width.cutoff=80))
library(summarytools)
library(dplyr)
```

We're going back to the COVID-19 data that we used before, we need to load it first.  (It's also available locally in the RStudio.cloud instance or from [my website](https://quantoid.net/files/reg3/counties.rda))

```{r}
library(stringr)
load(file("https://quantoid.net/files/reg3/counties.rda"))
```

This makes an object in your workspace called `counties`.  To remind, here's a summary of the data: 

```{r, results='asis'}
counties %>% 
  select(-c("fips", "NAME", "date", "state", "st")) %>% 
  dfSummary(., plain.ascii=FALSE)
```

I want you to use the data to answer the following questions. 

### Question 1

Choose variables and specify two separate models of `cases` (or cases per capita if you prefer, which you can make from the data).     

- Bootstrap the $R^{2}$ difference in the two models. 
- Try both a fixed-X and random-X scheme


### Question 2

Subset the data to look only at Maryland counties.  

- Bootstrap a LOESS curve relating per-capita cases to republican vote (`repvote`).  
- Try both a fixed-X and random-x resampling technique.  
- How do the confidence bounds you generate on predictions differ across the three methods (two bootstrap and one analytical)?  

