---
title: "Assignment 8"
subtitle: CRD 150
author: YOUR FULL NAME HERE
date: INSERT DATE HERE
output: 
  html_document:
    theme: cosmo
---


```{r setup, include=FALSE}
# Do not edit this code block/chunk
knitr::opts_chunk$set(echo = TRUE, warning=FALSE, message = FALSE)
knitr::opts_knit$set(progress = TRUE, verbose = TRUE)
```

```{r}
#Load in all necessary packages using the function library()
```

  
1. In Assignment 6, we descriptively examined the claim that Houston is the most racially integrated city in the United States. Let's employ the segregation tools we learned this week to explore this claim even further.  Let's also compare Houston to Sacramento, a city that has also been proclaimed as among most racially diverse in the nation.  Read in the Houston and Sacramento shapefiles houstondems.shp and sacdems.shp, which can be found on Canvas in the zipped folder Assignment8q1.zip (Files - Week 8 - Assignment). A record layout of the data can be found [here](https://raw.githubusercontent.com/crd150/data/master/sac_houston_metro_tracts_record_layout.txt).

a. Calculate the Black/White, Hispanic/White and Asian/White Dissimilarity Indices for Houston and Sacramento. Present these values in a presentation-ready table(s). 

```{r}
#Add comment explaining code
```

b. Calculate the Black/White, Hispanic/White and Asian/White Interaction Indices for Houston and Sacramento. Present these values in a presentation-ready table(s). 

```{r}
#Add comment explaining code
```

c. Based on your answers to questions (a) and (b), which city is most segregated? Why? 

```{r}
#Add comment explaining code
```

d. Instead of examining segregation at the city level, let’s find where it exists at the neighborhood level. Calculate the Location Quotient for Racial Residential Segregation (LQRSS) for the Asian population for each city. 

```{r}
#Add comment explaining code
```

e. Show presentation-ready maps of the Asian LQRSS for each city. 

```{r}
#Add comment explaining code
```

f. Let’s examine the socioeconomic variables that may be correlated with neighborhood Asian concentration in each city.  Calculate the correlation between the Asian LQRSS and percent of residents under 18 years old, percent of residents between 22 and 34, and percent foreign born in Houston. Do the same for Sacramento. Summarize the results in your own words, noting differences and similarities between the two cities. 

```{r}
#Add comment explaining code
```


2. We created a gentrification measure for the City of Fresno in Lab 8b. This question asks you to use the same method from Lab (Ding et al., 2016) to create a gentrification measure for the City of Sacramento, which has received a lot of local media attention for the rising presence of gentrification in certain neighborhoods. Download the file assignment8q2.zip from Canvas (Files - Week 8 - Assignment) into the appropriate folder on your hard drive. Unzip the file and read in the file saccitygent.shp, which is a shapefile of Sacramento census tract boundaries and demographic and socioeconomic variables. Consider the dataset to be cleaned and ready for analysis. A record layout of the data can be found here.

a. Create a variable that determines whether a neighborhood is not eligible for gentrification, is eligible and is not gentrifying, and is eligible and is gentrifying using the Ding et al., measure. 

```{r}
#Add comment explaining code
```

b. Show a presentation-ready table of the percentages of tracts in Sacramento that were not eligible to gentrify, experienced gentrification and did not experience gentrification between 2010 and 2019. 

```{r}
#Add comment explaining code
```

c. Produce a presentation-ready map of the gentrification variable you created in (a). From the map, summarize the spatial patterns of gentrification in the city.

```{r}
#Add comment explaining code
```


