Analysis #1-With this data set I was able to discern that precinct 3 delivered a response time with a response time that was greater than both precinct 8 & 13, and precinct 8 delivered the fastest response time. This difference can be attributed to the fact that precinct 3 is consisting mostly of white residents whilst precinct 18 and 8 consist of Hispanic residents and black residents respectively. This difference in response time can be attributed to more systemic issues with police response in communities of color, but should not be ignored due to that notion and due to the statistics being representative of a larger issue.
Analysis #2- The overall response time of Precinct 8 is significantly different than Precinct 12. The two precincts are built around and established for relatively wealthy residents and relatively poor residents respectively for precinct 8 & 12. with there being a 5 second difference in response time.
if (!require("tidyverse"))
install.packages("tidyverse")
library(tidyverse)
mydata <- read.csv("https://raw.githubusercontent.com/drkblake/Data/main/RichPoor.csv")
head(mydata,10)
## Minutes Precinct
## 1 4.0 Precinct 8
## 2 7.5 Precinct 8
## 3 10.5 Precinct 8
## 4 3.0 Precinct 8
## 5 10.1 Precinct 8
## 6 9.3 Precinct 8
## 7 9.6 Precinct 8
## 8 15.0 Precinct 8
## 9 2.6 Precinct 8
## 10 15.8 Precinct 8
mydata$DV <- mydata$Minutes
mydata$IV <- mydata$Precinct
averages <- group_by(mydata, IV) %>%
summarise(mean = mean(DV, na.rm = TRUE))
ggplot(mydata, aes(x = DV)) +
geom_histogram() +
facet_grid(IV ~ .) +
geom_histogram(color = "black", fill = "#1f78b4") +
geom_vline(data = averages, aes(xintercept = mean, ))
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
group_by(mydata, IV) %>%
summarise(
count = n(),
mean = mean(DV, na.rm = TRUE),
sd = sd(DV, na.rm = TRUE),
min = min(DV, na.rm = TRUE),
max = max(DV, na.rm = TRUE))
## # A tibble: 2 × 6
## IV count mean sd min max
## <chr> <int> <dbl> <dbl> <dbl> <dbl>
## 1 Precinct 12 159 14.3 7.05 -4.6 34.6
## 2 Precinct 8 132 9.15 4.48 -2.9 18.3
options(scipen = 999)
t.test(mydata$DV ~ mydata$IV,
var.equal = FALSE)
##
## Welch Two Sample t-test
##
## data: mydata$DV by mydata$IV
## t = 7.5258, df = 271.55, p-value = 0.0000000000007732
## alternative hypothesis: true difference in means between group Precinct 12 and group Precinct 8 is not equal to 0
## 95 percent confidence interval:
## 3.787442 6.471049
## sample estimates:
## mean in group Precinct 12 mean in group Precinct 8
## 14.27925 9.15000
Analysis #3- This line of code shows the difference in response time, with the mean difference in response time being 4.75 seconds between 2018 and 2022, with it increasing in response time over the four years.