--- 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} load(file("https://quantoid.net/files/reg3/l3/counties.rda")) ``` This makes an object in your workspace called `counties`. To remind, here's a summary of the data: ```{r, results='asis', eval=FALSE} codebook <- as.data.frame(sapply(counties, function(x)attr(x, "label"))) %>% as_tibble(rownames = "varname") %>% setNames(c("varname", "description")) library(DT) datatable(codebook) ``` I want you to use the data to answer the following questions. ### Question 1 Choose a few continuous variables as predictors of `cases_per100k` and estimate a linear model. - Diagnose any problems of non-linearity. - Try to fix any non-linearity problems by changing the specification of the independent variables. - How does the model change? ### Question 2 Using the same independent variables as in question 1, do the following: - Estimate the base model again with no transformations or changes to the original independent variable specifications. - Try the methods discussed in lecture to transform the dependent variable.