Regression (pt. 2)

Full reproducible regression example with spatial data

First, download the RMarkdown template here:

Then, copy the data preparation step from below and paste it into the template. Complete other regression steps appropriately.

wi_data <- get_acs(geography = "county",
                   geometry = TRUE,
                   state = 55,
                   variables = c(education = "B07009_005",
                                 income = "B19113_001",
                                 pop = "B01003_001",
                                 white = "B02001_002"),
                   output = "wide") %>%
  transmute(perBach = educationE / popE,
            pop = popE,
            popDens = as.numeric((popE / st_area(.)) * 1000 * 1000),
            perNonWhite = (popE - whiteE) / popE,
            income = incomeE)