Download the tutorial file, knit it to see the complete analysis, then run it chunk by chunk to understand each step.
In this lab you will compare economic hardship across two ACS time periods — 2009–2013 and 2015–2019 — to identify where conditions are worsening, improving, or stable. Both periods use 2010 TIGER/Line tract boundaries so GEOIDs match perfectly. You will apply pooled standardization, test whether changes exceed sampling noise using margin-of-error significance testing, and overlay LISA hot spots from Lab 4 on the change map.
The tutorial walks through every step with fully working code. Knit it first to see the finished product, then go back and run chunk by chunk to understand how it works.
tidycensuspatchworkCreate this folder structure before downloading anything. Move the downloaded .qmd into PAF516/Lab5/ before opening it in RStudio.
PAF516/
Lab1/ Lab2/ Lab3/ Lab4/
Lab5/
Lab5_Tutorial.qmd ← downloaded tutorial (do not edit)
Lab5_Tutorial.html ← auto-generated when you knit
Lab5_Assignment_Howell.qmd ← your renamed assignment copy
Lab5_Assignment_Howell.html ← submit this to Canvas
Lab6/ ...
Lab5_Tutorial.qmd in RStudiopackages chunk (labeled #| label: packages)renv block only runs once automaticallyThe lab pulls live data from the Census Bureau. If you don’t have a key yet:
census_api_key("YOUR_KEY_HERE", install = TRUE)Click the Render button (blue arrow, top of editor) or press Cmd+Shift+K / Ctrl+Shift+K. This produces Lab5_Tutorial.html with all results — change score summaries, diverging color maps, MOE significance maps, LISA overlay, and side-by-side comparison figures. Review the output to see what the completed analysis looks like.
Place your cursor inside any code chunk and press the run shortcut. Output appears inline. Fix any errors before moving on. This is how you understand what each step does.
| Action | Mac | PC |
|---|---|---|
| Run current chunk | Cmd+Return | Ctrl+Enter |
| Run all chunks above | Cmd+Option+P | Ctrl+Alt+P |
| Knit / Render | Cmd+Shift+K | Ctrl+Shift+K |
| Step | What It Does |
|---|---|
| Step 1 | Define 3-variable hardship index and pull 2013 and 2019 Maricopa County tract data |
| Step 2 | Reshape long-to-wide and compute poverty rate and unemployment rate |
| Step 3 | Pooled standardization — compute z-scores on the combined 2013+2019 scale |
| Step 4 | Join periods by GEOID and compute change scores (2019 − 2013) |
| Step 5 | MOE significance test — identify tracts where poverty change exceeds sampling noise |
| Step 6 | Change maps with diverging palette (blue = improved, red = worsened) and significance overlay |
| Step 7 | Side-by-side three-panel comparison: 2013, 2019, and change |
| Step 8 | LISA overlay — outline 2019 hot spots on the change map |
| Step 9 | Histogram of change score distribution |
Right-click → Save Link As. Save directly to your PAF516/Lab5/ folder. Do not open in the browser.