This repository contains code and scripts used in the paper "Higher Prevalence of Surveillance Cameras in Racially Diverse Neighborhoods across 10 US Cities". The study leverages computer vision techniques to analyze surveillance camera prevalence across various neighborhoods in 10 U.S. cities, focusing on understanding the relationship between camera prevalence and neighborhood racial diversity.
This analysis requires R and the following packages (specific versions tested on indicated):
tidyverse: 1.3.2pscl: 1.5.5conflicted: 1.2.0marginaleffects: 0.17.0ggpubr: 0.6.0sf: 1.0.12glue: 1.6.2tidycensus: 1.2.3broom: 1.0.4splines: 4.2.2scales: 1.2.1
The repository has been tested on:
- macOS Monterey
- Ensure that R is installed on your system (version 4.2.2 or higher recommended).
- Install the required R packages by running the following command in your R console:
install.packages(c("tidyverse", "pscl", "conflicted", "marginaleffects", "ggpubr", "sf", "glue", "tidycensus", "broom", "splines", "scales"))
- Clone this repository to your local machine.
This repository contains three R scripts used to generate the figures in the paper. Below is a description of each script:
descriptive-figures.R: Generates the descriptive statistics and visualizations, specifically Figures 1 and 5 in the paper.cs-results.R: Produces the results and figures highlighting the relationship between neighborhood racial composition and surveillance camera prevalence.change-results.R: Produces the results and figures for findings related to changes in surveillance camera prevalence.
The datasets and codebook used in this study are publicly available in the Stanford Digital Repository. The data can be accessed at the following link:
https://doi.org/10.25740/jr882ny4955
The repository includes:
- Datasets: Camera location data, neighborhood demographic data, and related variables.
- Codebook: Detailed descriptions of the variables and data sources used in the study.
All code for camera detection is here.
- Clone this repository:
- Download the datasets from the Stanford Digital Repository.
- Place the downloaded files in the data/ directory of the cloned repository.
- Run the provided R scripts.
All figures will be saved in the outputs/ directory.
Each analysis script takes approximately 2-5 minutes to execute.