COVID-19 and Crime in Western Australia

Did the lockdown associated with COVID-19 have a statistically significant impact on burglaries in Western Australia?

S3866666 Christopher Gallen

Last updated: 25 October, 2020

Introduction

Problem Statement

Data - Burglaries in Western Australia

Data - Scan

sum(is.na(crime))
## [1] 0
sum(sapply(crime, is.infinite))
## [1] 0
sum(sapply(crime, is.nan))
## [1] 0
sum(crime$`Burglary Total`<0)
## [1] 0

Data - How is the data distributed?

# Plot histogram of burglaries with a normal distribution overlay
hist(crime$`Burglary Total`, main="Distribution of Burglaries", xlab="Burglaries", freq=FALSE)
curve(dnorm(x, mean=mean(crime$`Burglary Total`), sd=sd(crime$`Burglary Total`)),
      col="red", lwd=2, n=100, add=TRUE)

Data - Variables

# Create new variables for year and month
crime <- crime[,c(1,33)]
crime <- mutate(crime, "Year"=year(`Month and Year`))
crime <- mutate(crime, "Month"=month(`Month and Year`, label=TRUE, abbr=FALSE))
crime <- crime[,-1]

Data - Does it fit a normal distribution?

crime$`Burglary Total` %>% qqPlot(dist="norm")

## [1] 162 161

Data - When did these outliers occur?

# Identify outliers
z.scores <- crime$`Burglary Total` %>% scores(type="z")
z.scores %>% summary()
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -4.30369 -0.59174  0.09832  0.00000  0.61522  2.00945
crime[which(abs(z.scores)>3),]
# Remove outliers and save as "covid"
covid <- crime[c(which(abs(z.scores)>3)),]
# Save remainder as "preCovid"
preCovid <- crime[-c(which(abs(z.scores)>3)),]

Descriptive Statistics and Visualisation

# Mean and standard deviation of the number of burglaries prior to COVID-19 lockdown
mean(preCovid$`Burglary Total`)
## [1] 2923.943
sd(preCovid$`Burglary Total`)
## [1] 323.863
# Mean number of burglaries from April to June 2020
mean(covid$`Burglary Total`)
## [1] 1289.333

Descriptive Statistics and Visualisation

hist(preCovid$`Burglary Total`, main="Distribution of Burglaries", xlab="Burglaries", freq=FALSE)
curve(dnorm(x, mean=mean(preCovid$`Burglary Total`), sd=sd(crime$`Burglary Total`)),
      col="red", lwd=2, n=100, add=TRUE)

Hypothesis Testing

Hypothesis Testing Cont.

# Apply t-test using a confidence interval of 99.9999%
t.test(preCovid$`Burglary Total`, conf.level = 0.999999)
## 
##  One Sample t-test
## 
## data:  preCovid$`Burglary Total`
## t = 113.84, df = 158, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 99.9999 percent confidence interval:
##  2793.176 3054.711
## sample estimates:
## mean of x 
##  2923.943

Discussion

Discussion

References