diff --git a/108/paper.pdf b/108/paper.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4b25265ee8d5f9aeb9f3f6c791acd4ebfb30cdbe --- /dev/null +++ b/108/paper.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b66be3b035bbc53e722346d2b7c0ee93865e87f98eb560a4303f2fca449eb93 +size 1047731 diff --git a/108/replication_package/Code/Step1_MainAnalysisAndData.R b/108/replication_package/Code/Step1_MainAnalysisAndData.R new file mode 100644 index 0000000000000000000000000000000000000000..72d4ae30006bfe1050910653136cc7fd0f43be53 --- /dev/null +++ b/108/replication_package/Code/Step1_MainAnalysisAndData.R @@ -0,0 +1,259 @@ +####### +####### +####### Replication files for Do Women Officers Police Differently? Evidence from Traffic Stops +####### This file cleans the raw data and runs the analysis for the body of the paper. +####### Last Updated: Jan. 2021 +####### +####### + + +### +### 1. Setting up the space. +### + +# Setting the working directory: +setwd("~/Desktop/PinkPolicing/AJPS_ReplicationFiles") + +# Installing the needed libraries: +#install.packages("pscl",dependencies = T) +#install.packages("ggplot2",dependencies = T) +#install.packages("texreg",dependencies = T) +#install.packages("readr",dependencies = T) +#install.packages("arm",dependencies = T) +#install.packages("dplyr",dependencies = T) + +# Opening up those libraries: +library(dplyr) +library(ggplot2) +library(texreg) +library(readr) +library(pscl) +library(arm) + +# Loading the raw data: +nc_new = read_csv("Data/Officer_Traffic_Stops_Update.csv") +nc_old = read_csv("Data/Officer_Traffic_Stops_Original.csv") +nc = bind_rows(nc_new,nc_old) +fl = read_csv("Data/fl_statewide_2019_08_13.csv") + + +### +### 2. Producing the data sets for each table. +### + +# Cleaning the NC Data +nc$driver_re = as.numeric(ifelse(nc$Driver_Race=="White"& + nc$Driver_Ethnicity=="Non-Hispanic","0", + ifelse(nc$Driver_Race=="Black"& + nc$Driver_Ethnicity=="Non-Hispanic","1", + ifelse(nc$Driver_Ethnicity=="Hispanic","2",NA)))) +nc$of_rg = ifelse(nc$Officer_Race=="White", + ifelse(nc$Officer_Gender=="Male","0","1"), + ifelse(nc$Officer_Race=="Black/African American", + ifelse(nc$Officer_Gender=="Male","2","3"),NA)) +nc$of_race = ifelse(nc$Officer_Race=="White",0, + ifelse(nc$Officer_Race=="Black/African American",1,NA)) +nc$of_gender = ifelse(nc$Officer_Gender=="Male","0","1") +nc$investigatory = ifelse(grepl("Impaired|Speeding|Light|Movement", + as.character(nc$Reason_for_Stop)),0,1) +nc$investigatory = ifelse(grepl("Check",as.character(nc$Reason_for_Stop)), + NA,nc$investigatory) +nc$race_gender = ifelse(nc$driver_re=="0", + ifelse(nc$Driver_Gender=="Male","0","1"), + ifelse(nc$driver_re=="1", + ifelse(nc$Driver_Gender=="Male","2","3"),NA)) +nc$search = ifelse(nc$Was_a_Search_Conducted=="Yes",1,0) + +nc$subject_sex = tolower(nc$Driver_Gender) +nc$subject_age = nc$Driver_Age +nc$officer_sex = tolower(nc$Officer_Gender) +nc$month = apply(as.matrix(as.character(nc$Month_of_Stop)),1, + function(x){strsplit(x,"/",fixed=T)[[1]][2]}) +nc$year = apply(as.matrix(as.character(nc$Month_of_Stop)),1, + function(x){strsplit(x,"/",fixed=T)[[1]][1]}) + +nc$arrest = ifelse(nc$Result_of_Stop=="Arrest",1,0) +save(nc,file="Data/NorthCarolina.RData") + +# Cleaning the FL data. +violations_list = strsplit(paste(fl$reason_for_stop,collapse = "|"),"|",fixed = T) +violations_list_small = unique(violations_list[[1]])[2:71] +violations_indicator = violations_list_small[c(1,2,5,6,7,9,10,14,19, + 20,23,40,45)] +fl$investigatory = ifelse(is.na(fl$violation),NA, + ifelse(fl$violation %in% violations_indicator, 0, 1)) +fl$contraband_found = ifelse(grepl("contraband", + tolower(fl$violation)),1,0) +fl$race_gender = ifelse(fl$subject_race=="white", + ifelse(fl$subject_sex=="male",0,1), + ifelse(fl$subject_race=="black", + ifelse(fl$subject_sex=="male",2,3), + ifelse(fl$subject_race=="hispanic", + ifelse(fl$subject_sex=="male",4,5),NA))) +fl$of_rg = ifelse(fl$officer_race=="white", + ifelse(fl$officer_sex=="male",0,1), + ifelse(fl$officer_race=="black", + ifelse(fl$officer_sex=="male",2,3), + ifelse(fl$officer_race=="hispanic", + ifelse(fl$officer_sex=="male",4,5),NA))) +fl$of_race = ifelse(fl$officer_race=="white",0, + ifelse(fl$officer_race=="black",1, + ifelse(fl$officer_race=="hispanic",2, + ifelse(fl$officer_race=="asian/pacific islander",3, + ifelse(fl$officer_race=="other",4,NA))))) +fl$of_gender = ifelse(fl$officer_sex=="male",0,1) +fl$out_of_state = ifelse(fl$vehicle_registration_state=="FL",0,1) +fl$hour_of_day = apply(as.matrix(as.character(fl$time)),1, + function(x)(strsplit(x,":",fixed = T)[[1]][1])) +fl$month = apply(as.matrix(as.character(fl$date)),1, + function(x)(paste(strsplit(x,"-",fixed = T)[[1]][2], + collapse = "_"))) +fl$year = apply(as.matrix(as.character(fl$date)),1, + function(x)(paste(strsplit(x,"-",fixed = T)[[1]][1], + collapse = "_"))) +fl = subset(fl,fl$year!="2016"&fl$year!="2017"&fl$year!="2018") #Narrows down to complete years that don't report extreme misingness on key outcome. +fl.officers = names(table(fl$officer_id_hash))[table(fl$officer_id_hash)>1000] +fl$officers_include = ifelse(fl$officer_id_hash%in%fl.officers,1,0) +fl.counties = names(table(fl$county_name))[table(fl$county_name)>1000] +fl$county_include = ifelse(fl$county_name%in%fl.counties,1,0) +fl.ag.id = aggregate(fl$of_gender, + list(fl$officer_id_hash,fl$year,fl$county_name), + mean) +fl.ag.id$officer = ifelse(!is.na(fl.ag.id$x),1,0) +fl.ag.gender = aggregate(fl.ag.id[,c("x","officer")], + list(fl.ag.id$Group.2,fl.ag.id$Group.3), + sum,na.rm=T) +fl.ag.gender$prop.female = fl.ag.gender$x/fl.ag.gender$officer +colnames(fl.ag.gender) = c("year","county_name","count.female","tot.officer","prop.female") +fl = merge(fl,fl.ag.gender,by=c("year","county_name"),all.x=T) +fl$officer_exclude = ifelse(fl$officer_years_of_service<0|fl$officer_years_of_service>40,1,0) +fl.ag.id2 = aggregate(fl$of_gender, + list(fl$officer_id_hash), + mean) +fl$search_occur = ifelse(fl$search_conducted == 0, 0, + ifelse(fl$search_basis != "other",1,NA)) +fl$contra = ifelse(is.na(fl$search_occur),0, + ifelse(fl$search_occur==1,fl$contraband_found,0)) + +complete = complete.cases(fl[,c("search_occur","race_gender","subject_age", + "out_of_state","investigatory","of_gender", + "of_race","officer_years_of_service","officer_age", + "hour_of_day","month","year","county_name")]) +fl.sm = fl[complete,] +complete2 = complete.cases(fl[,c("search_occur","of_gender")]) +table(complete) +table(complete2) + +fl.missingness = apply(fl[,c("search_occur","race_gender","subject_age", + "out_of_state","investigatory","of_gender", + "of_race","officer_years_of_service","officer_age", + "county_name")], + 2, + FUN = function(x){table(is.na(x))}) +save(fl,file="Data/FloridaLarge.RData") +save(fl.sm,file="Data/FloridaSmall.RData") + +fl$stops = ifelse(!is.na(fl$search_occur),1,0) +fl$contra.ttest = ifelse(fl$search_occur==1,fl$contra,NA) +prop.test(table(fl$of_gender,fl$contra.ttest)) +fl$of_exper = ifelse(fl$officer_years_of_service>= + mean(fl$officer_years_of_service,na.rm=T),1,0) +fl$of_age = ifelse(fl$officer_age<30,1, + ifelse(fl$officer_age>64,3,2)) +fl$driver_age = ifelse(fl$subject_age<30,1, + ifelse(fl$subject_age>64,3,2)) +fl$hour_of_day2 = as.numeric(fl$hour_of_day) +fl$tod = ifelse(fl$hour_of_day2<3,1, + ifelse(fl$hour_of_day2<6,2, + ifelse(fl$hour_of_day2<9,3, + ifelse(fl$hour_of_day2<12,4, + ifelse(fl$hour_of_day2<15,5, + ifelse(fl$hour_of_day2<18,6, + ifelse(fl$hour_of_day2<21,7,8))))))) + +fl.ag.officers = aggregate(fl[,c("stops","search_occur","contra")], + by=list(fl$officer_id_hash, + fl$of_race,fl$of_gender, + fl$of_exper,fl$of_age, + fl$race_gender,fl$driver_age, + fl$out_of_state,fl$investigatory, + fl$year,fl$tod), + sum,na.rm=T) +colnames(fl.ag.officers) = c("officer_id","of_race","of_gender","of_exper", + "of_age","race_gender","driver_age", + "out_of_state","investigatory","year", + "tod","stops","search_occur","contra") +fl.ag.officers$contra.search.rate = (fl.ag.officers$contra/fl.ag.officers$search_occur)*10 +fl.ag.officers$contra.stop.rate = (fl.ag.officers$contra/fl.ag.officers$stops)*100 +save(fl.ag.officers,file="Data/FL_Aggregated.RData") + +# Data for Figure 1 +search.df = data.frame("Department" = c("CPD","CPD","FHP","FHP"), + "Gender" = c("Male","Female","Male","Female"), + "Rate" = c(prop.table(table(nc$of_gender,nc$search),1)[,2], + prop.table(table(fl$of_gender[fl.sm$county_include==1& + fl.sm$officer_exclude==0], + fl$search_occur[fl.sm$county_include==1& + fl.sm$officer_exclude==0]),1)[,2])) +save(search.df,file="Data/Fig1_Data.RData") + +### +### 3. Regressions +### + +# +# For the Main Text: +# + +# Search Regressions +fl.search.sm = lm(search_occur~factor(of_gender),data=fl) +save(fl.search.sm, file="Data/FLSearch_Sm_OLS.RData") +fl.search = lm(search_occur~factor(race_gender)+ + subject_age+out_of_state+ + investigatory+ + factor(of_gender)+factor(of_race)+ + officer_years_of_service+officer_age+ + factor(hour_of_day)+factor(month)+factor(year)+ + factor(county_name), + data=fl.sm, + subset=fl.sm$county_include==1&fl.sm$officer_exclude==0) +save(fl.search,file="Data/FLSearch_OLS.RData") +nc.search.sm = lm(search~factor(of_gender),data = nc) +save(nc.search.sm,file="Data/NCSearch_Sm_OLS.RData") +nc.search = lm(search~factor(race_gender)+subject_age+ + investigatory+ + factor(of_race)+ + factor(of_gender)+Officer_Years_of_Service+ + factor(month)+factor(year)+ + factor(CMPD_Division), + data=nc) +save(nc.search,file="Data/NCSearch_OLS.RData") + +# Contraband Regressions +fl.contra = lm(contra~factor(race_gender)+ + subject_age+out_of_state+ + investigatory+ + factor(of_gender)+factor(of_race)+ + officer_years_of_service+officer_age+ + factor(hour_of_day)+factor(month)+factor(year)+ + factor(county_name), + data=fl.sm, + subset=fl.sm$county_include==1& + fl.sm$search_occur==1& + fl.sm$officer_exclude==0) +save(fl.contra,file="Data/FlContra_OLS.RData") +contra.search.rate.reg = lm(contra.search.rate ~ factor(of_gender) + factor(of_exper) + + factor(of_age) +factor(of_race) + + factor(race_gender) + factor(driver_age)+ + investigatory + out_of_state + + factor(year)+factor(tod), + data=fl.ag.officers, + subset=fl.ag.officers$search_occur>0) +save(contra.search.rate.reg,file="Data/FlSearchRate_OLS.RData") +contra.stop.rate.reg = lm(contra.stop.rate ~ factor(of_gender) + factor(of_exper) + + factor(of_age) + factor(of_race) + + factor(race_gender) + factor(driver_age)+ + investigatory + out_of_state + + factor(year)+factor(tod), + data=fl.ag.officers) +save(contra.stop.rate.reg,file="Data/FlStopRate_OLS.RData") \ No newline at end of file diff --git a/108/replication_package/Code/Step2_AppendixAnalysis.R b/108/replication_package/Code/Step2_AppendixAnalysis.R new file mode 100644 index 0000000000000000000000000000000000000000..fb3559e4a89e319a955954490de7506941978809 --- /dev/null +++ b/108/replication_package/Code/Step2_AppendixAnalysis.R @@ -0,0 +1,320 @@ +####### +####### +####### Replication files for Do Women Officers Police Differently? Evidence from Traffic Stops +####### This file runs most of the supplemental regressions shown in the appendix. +####### Last Updated: Jan. 2021 +####### +####### + +# Opening up those libraries: +library(dplyr) +library(ggplot2) +library(texreg) +library(readr) +library(pscl) +library(arm) + +# Setting the working directory: +setwd("~/Desktop/PinkPolicing/AJPS_ReplicationFiles") + +# +# Appendix: Alternative Specifications +# + +# Clearing the workspace. +rm(list = ls()) + +# Loading in the Data +load("Data/FloridaSmall.RData") +load("Data/FL_Aggregated.RData") + +# FE for Officer +fl.search = lmer(search_occur~factor(race_gender)+ + subject_age+out_of_state+ + investigatory+ + factor(of_gender)+factor(of_race)+ + officer_years_of_service+officer_age+ + factor(hour_of_day)+factor(month)+factor(year)+ + factor(county_name)+(1|officer_id_hash), + data=fl.sm, + subset=fl.sm$county_include==1&fl.sm$officer_exclude==0) +save(fl.search,file="Data/FLSearch_OLS_FE.RData") +fl.contra = lmer(contra~factor(race_gender)+ + subject_age+out_of_state+ + investigatory+ + factor(of_gender)+factor(of_race)+ + officer_years_of_service+officer_age+ + factor(hour_of_day)+factor(month)+factor(year)+factor(county_name)+ + (1|officer_id_hash), + data=fl.sm, + subset=fl.sm$county_include==1& + fl.sm$search_occur==1& + fl.sm$officer_exclude==0) +save(fl.contra,file="Data/FlContra_OLS_FE.RData") +contra.search.rate.reg = lmer(contra.search.rate ~ factor(of_gender) + factor(of_exper) + + factor(of_age) +factor(of_race) + + factor(race_gender) + factor(driver_age)+ + investigatory + out_of_state + + factor(year)+factor(tod)+ + (1|officer_id), + data=fl.ag.officers, + subset=fl.ag.officers$search_occur>0) +save(contra.search.rate.reg,file="Data/FlSearchRate_OLS_FE.RData") +contra.stop.rate.reg = lmer(contra.stop.rate ~ factor(of_gender) + factor(of_exper) + + factor(of_age) + factor(of_race) + + factor(race_gender) + factor(driver_age)+ + investigatory + out_of_state + + factor(year)+factor(tod)+(1|officer_id), + data=fl.ag.officers) +save(contra.stop.rate.reg,file="Data/FlStopRate_OLS_FE.RData") + +# Logistc Regressions +rm(list = ls()) + +load("Data/NorthCarolina.RData") +load("Data/FloridaSmall.RData") + +fl.search = glm(search_occur~factor(race_gender)+ + subject_age+out_of_state+ + investigatory+ + factor(of_gender)+factor(of_race)+ + officer_years_of_service+officer_age+ + factor(hour_of_day)+factor(month)+factor(year)+ + factor(county_name), + data=fl.sm,family="binomial", + subset=fl.sm$county_include==1&fl.sm$officer_exclude==0) +save(fl.search,file="Data/FLSearch_Logit.RData") +nc.search = glm(search~factor(race_gender)+subject_age+ + investigatory+ + factor(of_race)+ + factor(of_gender)+Officer_Years_of_Service+ + factor(month)+factor(year)+ + factor(CMPD_Division), + family="binomial", + data=nc) +save(nc.search,file="Data/NCSearch_Logit.RData") +fl.contra = glm(contra~factor(race_gender)+ + subject_age+out_of_state+ + investigatory+ + factor(of_gender)+factor(of_race)+ + officer_years_of_service+officer_age+ + factor(hour_of_day)+factor(month)+factor(year)+ + factor(county_name), + data=fl.sm, family = "binomial", + subset=fl.sm$county_include==1& + fl.sm$search_occur==1& + fl.sm$officer_exclude==0) +save(fl.contra,file="Data/FlContra_Logit.RData") + + +# +# Appendix: Interaction Models +# + +rm(list = ls()) + +load("Data/NorthCarolina.RData") +load("Data/FloridaSmall.RData") +load("Data/FloridaLarge.RData") +load("Data/FL_Aggregated.RData") + + +# Experience +fl.search.exper = lm(search_occur~factor(race_gender)+ + subject_age+out_of_state+ + investigatory+factor(of_race)+ + factor(of_gender)*officer_years_of_service+officer_age+ + factor(hour_of_day)+factor(month)+factor(year)+ + factor(county_name), + data=fl.sm, + subset=fl.sm$county_include==1&fl.sm$officer_exclude==0) +save(fl.search.exper,file="Data/FLSearch_Exper_OLS.RData") +nc.search.exper = lm(search~factor(race_gender)+subject_age+ + investigatory+factor(of_race)+ + factor(of_gender)*Officer_Years_of_Service+ + factor(month)+factor(year)+ + factor(CMPD_Division), + data=nc) +save(nc.search.exper,file="Data/NCSearch_Exper_OLS.RData") +fl.contra.exper = lm(contra~factor(race_gender)+ + subject_age+out_of_state+ + investigatory+factor(of_gender)*officer_years_of_service+ + factor(of_race)+officer_age+ + factor(hour_of_day)+factor(month)+factor(year)+ + factor(county_name), + data=fl.sm, + subset=fl.sm$county_include==1& + fl.sm$search_occur==1& + fl.sm$officer_exclude==0) +save(fl.contra.exper,file="Data/FlContra_Exper_OLS.RData") +contra.search.rate.exper = lm(contra.search.rate ~ factor(of_gender)*factor(of_exper) + + investigatory+factor(of_age) +factor(of_race) + + factor(race_gender) + factor(driver_age)+ + out_of_state + + factor(year), + data=fl.ag.officers, + subset=fl.ag.officers$search_occur>0) +save(contra.search.rate.exper,file="Data/FlSearchRate_Exper_OLS.RData") +contra.stop.rate.exper = lm(contra.stop.rate ~ factor(of_gender)*factor(of_exper) + + investigatory+ + factor(of_age) +factor(of_race) + + factor(race_gender) + factor(driver_age)+ + out_of_state + + factor(year), + data=fl.ag.officers) +save(contra.stop.rate.exper,file="Data/FlStopRate_Exper_OLS.RData") + +# Prop Female +fl$male.officer = ifelse(fl$of_gender==1,0,1) +fl.ag = aggregate(fl$officer_id_hash, + by=list(fl$of_gender,fl$county_name,fl$year), + function(x){length(unique(x))}) +fl.ag.m = fl.ag[fl.ag$Group.1==0,] +fl.ag.f = fl.ag[fl.ag$Group.1==1,] +colnames(fl.ag.m)=c("male","county_name","year","male.count") +colnames(fl.ag.f)=c("female","county_name","year","female.count") +fl.ag = merge(fl.ag.m,fl.ag.f,all=T) +fl.ag$male.count[is.na(fl.ag$male.count)] = 0 +fl.ag$female.count[is.na(fl.ag$female.count)] = 0 +fl.ag$female.prop = fl.ag$female.count/(fl.ag$female.count+fl.ag$male.count) +summary(fl.ag$female.prop) +fl.sm = merge(fl.sm,fl.ag) +fl.search.prop = lm(search_occur~factor(race_gender)+ + subject_age+out_of_state+ + investigatory+factor(of_race)+ + factor(of_gender)*female.prop+officer_years_of_service+officer_age+ + factor(hour_of_day)+factor(month)+factor(year)+ + factor(county_name), + data=fl.sm, + subset=fl.sm$county_include==1&fl.sm$officer_exclude==0) +save(fl.search.prop,file="Data/FLSearch_Prop_OLS.RData") +fl.contra.prop = lm(contra~factor(race_gender)+ + subject_age+out_of_state+ + investigatory+factor(of_gender)*female.prop+ + officer_years_of_service+ + factor(of_race)+officer_age+ + factor(hour_of_day)+factor(month)+factor(year)+ + factor(county_name), + data=fl.sm, + subset=fl.sm$county_include==1& + fl.sm$search_occur==1& + fl.sm$officer_exclude==0) +save(fl.contra.prop,file="Data/FlContra_Prop_OLS.RData") + +# Stop Type +fl.search.st = lm(search_occur~factor(race_gender)+ + subject_age+out_of_state+ + factor(of_gender)+factor(of_race)+ + officer_years_of_service+officer_age+ + factor(hour_of_day)+factor(month)+factor(year)+ + factor(county_name), + data=fl.sm, + subset=fl.sm$county_include==1&fl.sm$officer_exclude==0& + fl.sm$investigatory==1) +save(fl.search.st,file="Data/FLSearch_StopType_OLS.RData") +nc.search.st = lm(search~factor(race_gender)+subject_age+ + factor(of_gender)+ + factor(of_race)+Officer_Years_of_Service+ + factor(month)+factor(year)+ + factor(CMPD_Division), + data=nc, + subset = nc$investigatory==1) +save(nc.search.st,file="Data/NCSearch_StopType_OLS.RData") +fl.contra.st = lm(contra~factor(race_gender)+ + subject_age+out_of_state+ + factor(of_gender)+ + factor(of_race)+ + officer_years_of_service+officer_age+ + factor(hour_of_day)+factor(month)+factor(year)+ + factor(county_name), + data=fl.sm, + subset=fl.sm$county_include==1& + fl.sm$search_occur==1& + fl.sm$officer_exclude==0& + fl.sm$investigatory==1) +save(fl.contra.st,file="Data/FlContra_StopType_OLS.RData") +contra.search.rate.st = lm(contra.search.rate ~ factor(of_gender)+ + factor(of_exper) + + factor(of_age) +factor(of_race) + + factor(race_gender) + factor(driver_age)+ + out_of_state + + factor(year), + data=fl.ag.officers, + subset=fl.ag.officers$search_occur>0& + fl.ag.officers$investigatory==1) +save(contra.search.rate.st,file="Data/FlSearchRate_StopType_OLS.RData") +contra.stop.rate.st = lm(contra.stop.rate ~ factor(of_gender)+ + factor(of_exper) + + factor(of_age) +factor(of_race) + + factor(race_gender) + factor(driver_age)+ + out_of_state + + factor(year), + data=fl.ag.officers, + subset=fl.ag.officers$investigatory==1) +save(contra.stop.rate.st,file="Data/FlStopRate_StopType_OLS.RData") + +# Driver Characteristics +fl.sm$subject_female = ifelse(fl.sm$subject_sex=="female",1,0) +fl.sm$subject_race2 = ifelse(fl.sm$subject_race=="white",0, + ifelse(fl.sm$subject_race=="black",1,2)) +fl.search.inter = lm(search_occur~factor(of_gender)*factor(subject_female)+ + factor(of_race)*factor(subject_race2)+ + subject_age+out_of_state+investigatory+ + officer_years_of_service+officer_age+ + factor(hour_of_day)+factor(month)+factor(year)+ + factor(county_name), + data=fl.sm, + subset=fl.sm$county_include==1& + fl.sm$officer_exclude==0& + as.numeric(fl.sm$of_race)<3) +save(fl.search.inter,file="Data/FLInter_Search.RData") +fl.contra.inter = lm(contra~factor(of_gender)*factor(subject_female)+ + factor(of_race)*factor(subject_race2)+ + subject_age+out_of_state+investigatory+ + officer_years_of_service+officer_age+ + factor(hour_of_day)+factor(month)+factor(year)+ + factor(county_name), + data=fl.sm, + subset=fl.sm$search_occur==1& + fl.sm$county_include==1& + fl.sm$officer_exclude==0& + as.numeric(fl.sm$of_race)<3) +save(fl.contra.inter,file="Data/FLInter_Contra.RData") +fl.ag.officers$subject_female = ifelse(fl.ag.officers$race_gender%in%c(1,3,5),1,0) +fl.ag.officers$subject_race2 = ifelse(fl.ag.officers$race_gender%in%c(0,1),0, + ifelse(fl.ag.officers$race_gender%in%c(2,3),1,2)) +contra.search.rate.inter = lm(contra.search.rate ~ factor(of_gender)*factor(subject_female) + + factor(of_race) * factor(subject_race2)+ + factor(of_exper) + factor(of_age) + + factor(race_gender) + factor(driver_age)+ + investigatory + out_of_state + + factor(year), + data=fl.ag.officers, + subset=fl.ag.officers$search_occur>0) +save(contra.search.rate.inter,file="Data/FlSearchRate_Inter_OLS.RData") +contra.stop.rate.inter = lm(contra.stop.rate ~ factor(of_gender)*factor(subject_female) + + factor(of_race) * factor(subject_race2)+ + factor(of_exper) + factor(of_age) + + factor(race_gender) + factor(driver_age)+ + investigatory + out_of_state + + factor(year), + data=fl.ag.officers) +save(contra.stop.rate.inter,file="Data/FlStopRate_Inter_OLS.RData") + +nc$of_race = ifelse(nc$Officer_Race=="White",0, + ifelse(nc$Officer_Race=="Black/African American",1, + ifelse(nc$Officer_Race=="Hispanic/Latino",2,NA))) +nc$subject_female = ifelse(nc$Driver_Gender=="Female",1,0) +nc$subject_race2 = ifelse(nc$Driver_Race=="White"& + nc$Driver_Ethnicity=="Non-Hispanic",0, + ifelse(nc$Driver_Race=="Black"& + nc$Driver_Ethnicity=="Non-Hispanic",1, + ifelse(nc$Driver_Ethnicity=="Hispanic",2,NA))) +nc.search.inter = lm(search~factor(of_gender)*factor(subject_female)+ + factor(of_race)*factor(subject_race2)+ + subject_age+investigatory+ + Officer_Years_of_Service+ + factor(month)+factor(year)+ + factor(CMPD_Division), + data=nc) +save(nc.search.inter,file = "Data/NCInter_Search.RData") \ No newline at end of file diff --git a/108/replication_package/Code/Step3_TablesAndFigures.R b/108/replication_package/Code/Step3_TablesAndFigures.R new file mode 100644 index 0000000000000000000000000000000000000000..575670c248aad45683051294427bd831a4cafae9 --- /dev/null +++ b/108/replication_package/Code/Step3_TablesAndFigures.R @@ -0,0 +1,630 @@ +####### +####### +####### Replication files for Do Women Officers Police Differently? Evidence from Traffic Stops +####### This file produces the tables and figures seen in the paper and appendix. +####### Last Updated: Jan. 2021 +####### +####### + +### +### 1. Setting up the space. +### + +# Setting the working directory: +setwd("~/Desktop/PinkPolicing/AJPS_ReplicationFiles") + +# Installing the needed libraries: +#install.packages("pscl",dependencies = T) +#install.packages("ggplot2",dependencies = T) +#install.packages("texreg",dependencies = T) +#install.packages("readr",dependencies = T) +#install.packages("arm",dependencies = T) + +# Opening up those libraries: +library(ggplot2) +library(texreg) +library(readr) +library(pscl) +library(arm) + +### +### 2. Body of the Paper +### + +# Clearing the workspace + reading in data bit by bit to produce each table and figure. +rm(list = ls()) + +# Loading in the Data +load("Data/NorthCarolina.RData") +load("Data/FloridaLarge.RData") +load("Data/FloridaSmall.RData") +cmpd.employee = read_csv("Data/CMPD_Employee_Demographics.csv") + +# Number of stops and searches by sex: +dim(fl) +dim(nc) + +table(fl$search_occur) +table(nc$search) + +prop.table(table(fl$search_occur)) +prop.table(table(nc$search)) + +table(fl$of_gender) +table(nc$of_gender) + +table(fl$of_gender,fl$search_occur) +table(nc$of_gender,nc$search) + +prop.table(table(fl$of_gender,fl$search_occur),1) +prop.table(table(nc$of_gender,nc$search),1) + +table(fl$of_gender,fl$contra) + +# Number of officers by sex in FL +length(unique(fl$officer_id_hash)) +length(unique(fl$officer_id_hash[fl$of_gender==0])) +length(unique(fl$officer_id_hash[fl$of_gender==1])) + +length(unique(fl$officer_id_hash[fl$officer_exclude==0])) +length(unique(fl$officer_id_hash[fl$of_gender==0&fl$officer_exclude==0])) +length(unique(fl$officer_id_hash[fl$of_gender==1&fl$officer_exclude==0])) + +table(cmpd.employee$JOB_TITLE[cmpd.employee$JOB_TITLE=="Police Officer"]) +sum(table(cmpd.employee$Gender[cmpd.employee$JOB_TITLE=="Police Officer"])) + +table(fl$year) +(table(fl$of_gender)/c(length(unique(fl$officer_id_hash[fl$of_gender==0&fl$officer_exclude==0])),length(unique(fl$officer_id_hash[fl$of_gender==1&fl$officer_exclude==0]))))/6 + +avg.stops = aggregate(fl$year,by=list(fl$officer_id_hash,fl$year,fl$of_gender),length) +summary(avg.stops) +mean(avg.stops$x) +median(avg.stops$x[avg.stops$Group.3==0]) +median(avg.stops$x[avg.stops$Group.3==1]) + +prop.table(table(fl$investigatory[fl$of_gender==0])) +prop.table(table(fl$investigatory[fl$of_gender==1])) + +table(nc$of_gender[nc$year==2019])[2:1]/table(cmpd.employee$Gender[cmpd.employee$JOB_TITLE=="Police Officer"]) + +# Excluding Cases: +dim(nc) +dim(nc)-dim(nc[!is.na(nc$search),]) +dim(fl) +dim(fl)-dim(fl[!is.na(fl$search_occur),]) +(dim(fl[!is.na(fl$search_occur),])-dim(fl.sm))+table(fl.sm$officer_exclude)[2] +table(fl.sm$county_include) + +# Table 1 +tab1 = data.frame("Department"=c("Charlotte PD (NC)", + "Male Officers","Female Officers", + "Florida Highwar Patrol", + "Male Officers","Female Officers"), + "Type"=c("Municipal","","","Statewide","",""), + "Years"=c("2016-2017","","", + "2010-2015","",""), + "Stops"=c(dim(nc)[1],table(nc$of_gender), + dim(fl[!is.na(fl$search_occur),])[1], + table(fl$of_gender[!is.na(fl$search_occur)])), + "Searches"=c(table(nc$search)[2],table(nc$of_gender,nc$search)[,2], + table(fl$search_occur)[2], + table(fl$of_gender,fl$search_occur)[,2]), + "Search Rate"=c(table(nc$search)[2]/dim(nc)[1], + table(nc$of_gender,nc$search)[,2]/table(nc$of_gender), + table(fl$search_occur)[2]/dim(fl[!is.na(fl$search_occur),])[1], + table(fl$of_gender,fl$search_occur)[,2]/ + table(fl$of_gender[!is.na(fl$search_occur)]))) +tab1 = rbind(tab1, + c("Total","","", + sum(tab1[c(1,4),4]),sum(tab1[c(1,4),5]), + sum(tab1[c(1,4),5])/sum(tab1[c(1,4),4]))) +tab1 + +# Figure 1 +load("Data/Fig1_Data.RData") +png("Figures/Fig1_PredProb.png", + 750,519) +ggplot(data = search.df, aes(x=Department,y=Rate,fill=Gender)) + + geom_bar(stat="identity", position=position_dodge()) + + ylab("Search Rate") + + theme_bw(base_size=15)+ + theme(legend.position = "bottom") + + labs(fill="Officer Sex")+ + scale_fill_grey(start = 0.25, end = .75) +dev.off() + +prop.test(table(fl$of_gender,fl$search_occur)) +prop.test(table(nc$of_gender,nc$search)) + +# Table 2 +load("Data/FLSearch_Sm_OLS.RData") +load("Data/FLSearch_OLS.RData") +load("Data/NCSearch_Sm_OLS.RData") +load("Data/NCSearch_OLS.RData") +screenreg(list(nc.search,fl.search), + stars=c(0.01,0.05), + custom.coef.map = list("(Intercept)"="(Intercept)", + "factor(of_gender)1"="Female Officer", + "factor(of_race)1"="Black Officer", + "factor(race_gender)1"="White Female", + "factor(race_gender)2"="Black Male", + "factor(race_gender)3"="Black Female", + "factor(race_gender)4"="Latino Male", + "factor(race_gender)5"="Latina Female", + "investigatory" = "Investigatory Stop Purpose"), + custom.model.names = c("(1) NC Search", + "(2) FL Search"), + digits=4) + +# Figure 2 +fl.of.pred = predict(fl.search, + newdata = data.frame("of_gender"=c(0,1),"race_gender"=0, + "subject_age"=35,"out_of_state"=0, + "investigatory"=1, + "officer_years_of_service"=6, + "of_race"=0,"officer_age"=39, + "hour_of_day"=15, + "month"="05","year"=2013, + "county_name"="Orange County"), + type="response",se.fit=T) +nc.of.pred = predict(nc.search, + newdata = data.frame("of_gender"=c(0,1), + "race_gender"=0, + "subject_age"=36, + "investigatory"=1, + "Officer_Years_of_Service"=10.25, + "of_race"=0,"month"="01", + "year"=2019,"CMPD_Division"="South Division"), + type="response",se.fit=T) + + + +pred.df = data.frame("Department" = c("Charlotte Police Department", + "Charlotte Police Department", + "Florida Highway Patrol", + "Florida Highway Patrol"), + "Gender" = c("Male","Female","Male","Female"), + "Predict" = c(nc.of.pred$fit, + fl.of.pred$fit), + "Lower"=c(nc.of.pred$fit-1.96*nc.of.pred$se.fit, + fl.of.pred$fit-1.96*fl.of.pred$se.fit), + "Upper"=c(nc.of.pred$fit+1.96*nc.of.pred$se.fit, + fl.of.pred$fit+1.96*fl.of.pred$se.fit)) + +png("Figures/Fig2_PredProb.png", + 900,514) +ggplot(data = pred.df, aes(x=Gender,y=Predict)) + + geom_point(size=4) + + geom_errorbar(aes(ymin = Lower, ymax = Upper), + width=.2,size = 0.75, + position=position_dodge(.9)) + + ylab("Expected Probbility of a Search") + + xlab("Officer Sex") + + theme_bw(base_size=15) +facet_wrap(~Department) +dev.off() + +pred.df$Predict[1]/pred.df$Predict[2] +pred.df$Predict[3]/pred.df$Predict[4] + +# Table 3 +tab3 = data.frame("Officer Gender"=c("Male","Female"), + "Searches"=table(fl$of_gender[!is.na(fl$search_occur)], + fl$search_occur[!is.na(fl$search_occur)])[,2], + "Contraband"=table(fl$of_gender[!is.na(fl$search_occur)], + fl$contra[!is.na(fl$search_occur)])[,2], + "Contraband Hit Rate"=table(fl$of_gender[!is.na(fl$search_occur)], + fl$contra[!is.na(fl$search_occur)])[,2]/ + table(fl$of_gender[!is.na(fl$search_occur)], + fl$search_occur[!is.na(fl$search_occur)])[,2], + "Difference"=c((table(fl$of_gender[!is.na(fl$search_occur)], + fl$contra[!is.na(fl$search_occur)])[,2]/ + table(fl$of_gender[!is.na(fl$search_occur)], + fl$search_occur[!is.na(fl$search_occur)])[,2])[1]- + (table(fl$of_gender[!is.na(fl$search_occur)], + fl$contra[!is.na(fl$search_occur)])[,2]/ + table(fl$of_gender[!is.na(fl$search_occur)], + fl$search_occur[!is.na(fl$search_occur)])[,2])[2],NA)) +tab3 +prop.test(table(fl$of_gender[fl$search_occur==1], + fl$contra[fl$search_occur==1])) + +# Table 4 +load("Data/FlContra_OLS.RData") +load("Data/FlSearchRate_OLS.RData") +load("Data/FlStopRate_OLS.RData") +screenreg(list(fl.contra,contra.search.rate.reg,contra.stop.rate.reg), + stars=c(0.01,0.05), + custom.coef.map = list("(Intercept)"="(Intercept)", + "factor(of_gender)1"="Female Officer", + "factor(of_race)1"="Black Officer", + "factor(race_gender)1"="White Female", + "factor(race_gender)2"="Black Male", + "factor(race_gender)3"="Black Female", + "factor(race_gender)4"="Latino Male", + "factor(race_gender)5"="Latina Female", + "investigatory" = "Investigatory Stop Purpose"), + custom.model.names = c("(1) Contra|Search", + "(2) Hit Rate, per 10 Searches", + "(3) Hit Rate, per 100 Stops"), + digits=4) + +### +### 3. Appendix A: Full Regression Results +### + +screenreg(list(nc.search,fl.search, + fl.contra,contra.search.rate.reg,contra.stop.rate.reg), + stars=c(0.01,0.05), + custom.coef.map = list("(Intercept)"="(Intercept)", + "factor(of_gender)1"="Female Officer", + "factor(of_race)1"="Black Officer", + "officer_age"="Officer Age", + "factor(of_age)2"="Officer Age: 30-64", + "factor(of_age)3"="Officer Age: 65+", + "officer_years_of_service"="Officer Years of Service", + "Officer_Years_of_Service"="Officer Years of Service", + "factor(of_exper)1"="Experienced Officer", + "factor(race_gender)1"="White Female", + "factor(race_gender)2"="Black Male", + "factor(race_gender)3"="Black Female", + "factor(race_gender)4"="Latino Male", + "factor(race_gender)5"="Latina Female", + "subject_age"="Driver Age", + "factor(driver_age)2"="Driver Age: 30-64", + "factor(driver_age)3"="Driver Age: 65+", + "investigatory" = "Investigatory Stop Purpose", + "out_of_state"="Out of State"), + custom.model.names = c("(1)","(2)", + "(3)","(4)","(5)"), + digits=3) + +### +### 4. Appendix B: Alternative Test of Differences in Search and Contraband Hit Rates +### + +# Florida +fl$stop = 1 +fl$of_exper = ifelse(fl$officer_years_of_service>= + mean(fl$officer_years_of_service,na.rm=T),1,0) +fl$of_age = ifelse(fl$officer_age<30,1, + ifelse(fl$officer_age>64,3,2)) +fl$driver_age = ifelse(fl$subject_age<30,1, + ifelse(fl$subject_age>64,3,2)) +fl$hour_of_day=as.numeric(fl$hour_of_day) +fl$tod = ifelse(fl$hour_of_day<3,1, + ifelse(fl$hour_of_day<6,2, + ifelse(fl$hour_of_day<9,3, + ifelse(fl$hour_of_day<12,4, + ifelse(fl$hour_of_day<15,5, + ifelse(fl$hour_of_day<18,6, + ifelse(fl$hour_of_day<21,7,8))))))) + +fl.ag = aggregate(fl[!is.na(fl$search_occur),c("stop","search_occur","contra")], + by = list(fl$tod[!is.na(fl$search_occur)], + fl$officer_race[!is.na(fl$search_occur)], + fl$officer_sex[!is.na(fl$search_occur)], + fl$of_exper[!is.na(fl$search_occur)], + fl$race_gender[!is.na(fl$search_occur)], + fl$driver_age[!is.na(fl$search_occur)], + fl$out_of_state[!is.na(fl$search_occur)], + fl$investigatory[!is.na(fl$search_occur)]), + sum,na.rm=T) +colnames(fl.ag) = c("tod", + "of_race","of_sex","of_exper","driver_rg", + "driver_age","out_of_state","invest", + "stop","search","contraband") +fl.ag.female = fl.ag[fl.ag$of_sex=="female",] +colnames(fl.ag.female)[c(3,9:11)] = c("female","stop.f", + "search.f","contra.f") +fl.ag.male = fl.ag[fl.ag$of_sex=="male",] +colnames(fl.ag.male)[c(3,9:11)] = c("male","stop.m", + "search.m","contra.m") + +fl.matches = merge(fl.ag.female,fl.ag.male) +min.stops = 9 +table(fl.matches$stop.f>min.stops& + fl.matches$stop.m>min.stops) +min.searches = 0 +table(fl.matches$search.f>min.searches& + fl.matches$search.m>min.searches) +table(fl.matches$search.f>min.searches& + fl.matches$search.m>min.searches& + fl.matches$stop.f>min.stops& + fl.matches$stop.m>min.stops) + +# North Carolina +nc$stop = 1 +nc$search = ifelse(nc$Was_a_Search_Conducted=="Yes",1,0) +nc$driver_age = ifelse(nc$Driver_Age<30,1, + ifelse(nc$Driver_Age>65,3,2)) +nc$of_exper = ifelse(nc$Officer_Years_of_Service>=mean(nc$Officer_Years_of_Service), + 1,0) +nc.ag = aggregate(nc[,c("search","stop")], + by = list(nc$CMPD_Division, + nc$Officer_Gender,nc$Officer_Race, + nc$of_exper, + nc$race_gender,nc$driver_age, + nc$investigatory, + nc$year), + sum) +nc.ag.female = nc.ag[nc.ag$Group.2=="Female",] +colnames(nc.ag.female) = c("division","female","race","of_exper", + "driver.rg","driver_age","investigatory", + "year", + "searches.f","stops.f") +nc.ag.male = nc.ag[nc.ag$Group.2=="Male",] +colnames(nc.ag.male) = c("division","male","race","of_exper", + "driver.rg","driver_age","investigatory", + "year", + "searches.m","stops.m") + + +# Searches +fl.matches$sr.f = fl.matches$search.f/fl.matches$stop.f +fl.matches$sr.m = fl.matches$search.m/fl.matches$stop.m +fl.matches$cr.f = fl.matches$contra.f/fl.matches$search.f +fl.matches$cr.m = fl.matches$contra.m/fl.matches$search.m +t.test(fl.matches$sr.f[fl.matches$stop.f>min.stops& + fl.matches$stop.m>min.stops], + fl.matches$sr.m[fl.matches$stop.f>min.stops& + fl.matches$stop.m>min.stops], + paired = T) +length(fl.matches$sr.f[fl.matches$stop.f>min.stops& + fl.matches$stop.m>min.stops]) +mean(fl.matches$sr.f[fl.matches$stop.f>min.stops& + fl.matches$stop.m>min.stops]) +mean(fl.matches$sr.m[fl.matches$stop.f>min.stops& + fl.matches$stop.m>min.stops]) + +nc.matches = merge(nc.ag.female,nc.ag.male) +min.stops = 9 +nc.matches$sr.f = nc.matches$searches.f/nc.matches$stops.f +nc.matches$sr.m = nc.matches$searches.m/nc.matches$stops.m +t.test(nc.matches$sr.f[nc.matches$stops.f>min.stops& + nc.matches$stops.m>min.stops], + nc.matches$sr.m[nc.matches$stops.f>min.stops& + nc.matches$stops.m>min.stops], + paired = T) + +length(nc.matches$sr.f[nc.matches$stops.f>min.stops& + nc.matches$stops.m>min.stops]) +mean(nc.matches$sr.f[nc.matches$stops.f>min.stops& + nc.matches$stops.m>min.stops]) +mean(nc.matches$sr.m[nc.matches$stops.f>min.stops& + nc.matches$stops.m>min.stops],) + +# Contraband +t.test(fl.matches$cr.f[fl.matches$search.f>min.searches& + fl.matches$search.m>min.searches& + fl.matches$stop.f>min.stops& + fl.matches$stop.m>min.stops], + fl.matches$cr.m[fl.matches$search.f>min.searches& + fl.matches$search.m>min.searches& + fl.matches$stop.f>min.stops& + fl.matches$stop.m>min.stops], + paired = T) +length(fl.matches$cr.f[fl.matches$search.f>min.searches& + fl.matches$search.m>min.searches& + fl.matches$stop.f>min.stops& + fl.matches$stop.m>min.stops]) +mean(fl.matches$cr.f[fl.matches$search.f>min.searches& + fl.matches$search.m>min.searches& + fl.matches$stop.f>min.stops& + fl.matches$stop.m>min.stops]) +mean(fl.matches$cr.m[fl.matches$search.f>min.searches& + fl.matches$search.m>min.searches& + fl.matches$stop.f>min.stops& + fl.matches$stop.m>min.stops]) + +### +### 5. Appendix C: Logistic Regrssion Models +### + +rm(list = ls()) + +load("Data/FlContra_Logit.RData") +load("Data/FLSearch_Logit.RData") +load("Data/NCSearch_Logit.RData") + +texreg(list(nc.search,fl.search,fl.contra), + stars=c(0.01,0.05), + custom.coef.map = list("(Intercept)"="(Intercept)", + "factor(of_gender)1"="Female Officer", + "factor(of_race)1"="Black Officer", + "factor(of_race)2"="Latinx Officer", + "factor(of_race)3"="Asain/Pacific Islander Officer", + "factor(of_race)4"="Other Race Officer", + "officer_age"="Officer Age", + "officer_years_of_service"="Officer Years of Service", + "Officer_Years_of_Service"="Officer Years of Service", + "factor(race_gender)1"="White Female", + "factor(race_gender)2"="Black Male", + "factor(race_gender)3"="Black Female", + "factor(race_gender)4"="Latino Male", + "factor(race_gender)5"="Latina Female", + "subject_age"="Driver Age", + "investigatory" = "Investigatory Stop Purpose", + "out_of_state"="Out of State"), + custom.model.names = c("(1) NC Search", + "(2) FL Search", + "(3) FL Contra|Search"), + digits=4) + +### +### 6. Appendix C: Fixed Effects +### + +rm(list = ls()) + +load("Data/FLSearch_OLS_FE.RData") +load("Data/FlContra_OLS_FE.RData") +load("Data/FlSearchRate_OLS_FE.RData") +load("Data/FlStopRate_OLS_FE.RData") + +texreg(list(fl.search, + fl.contra, + contra.search.rate.reg, + contra.stop.rate.reg), + stars=c(0.01,0.05), + custom.coef.map = list("(Intercept)"="(Intercept)", + "factor(of_gender)1"="Female Officer", + "factor(of_race)1"="Black Officer", + "officer_age"="Officer Age", + "factor(of_age)2"="Officer Age: 30-64", + "factor(of_age)3"="Officer Age: 65+", + "officer_years_of_service"="Officer Years of Service", + "Officer_Years_of_Service"="Officer Years of Service", + "factor(of_exper)1"="Experienced Officer", + "factor(race_gender)1"="White Female", + "factor(race_gender)2"="Black Male", + "factor(race_gender)3"="Black Female", + "factor(race_gender)4"="Latino Male", + "factor(race_gender)5"="Latina Female", + "subject_age"="Driver Age", + "factor(driver_age)2"="Driver Age: 30-64", + "factor(driver_age)3"="Driver Age: 65+", + "investigatory" = "Investigatory Stop Purpose", + "out_of_state"="Out of State"), + custom.model.names = c("(1) Search", + "(2) Contra|Search", + "(3) Hit Rate, per 10 Searches", + "(4) Hit Rate, per 100 Stops"), + digits=4) + +### +### 7. Appendix D: Interaction Models +### + +rm(list = ls()) + +# Table 1. Officer Experience +load("Data/FLSearch_Exper_OLS.RData") +load("Data/NCSearch_Exper_OLS.RData") +load("Data/FlContra_Exper_OLS.RData") +load("Data/FlSearchRate_Exper_OLS.RData") +load("Data/FlStopRate_Exper_OLS.RData") + +texreg(list(nc.search.exper,fl.search.exper,fl.contra.exper, + contra.search.rate.exper,contra.stop.rate.exper), + stars=c(0.05,0.01), + custom.coef.map = list("factor(of_gender)1"="Female Officer", + "officer_years_of_service"="Officer Years of Service", + "Officer_Years_of_Service"="Officer Years of Service", + "factor(of_exper)1"="Experienced Officer", + "factor(of_gender)1:officer_years_of_service"="Female Officer * Exper.", + "factor(of_gender)1:Officer_Years_of_Service"="Female Officer * Exper.", + "factor(of_gender)1:factor(of_exper)1"="Female Officer * Exper."), + digits = 3) + +# Table 2. Prop Female +load("Data/FLSearch_Prop_OLS.RData") +load("Data/FlContra_Prop_OLS.RData") + +texreg(list(fl.search.prop,fl.contra.prop), + stars=c(0.05,0.01), + custom.coef.map = list("factor(of_gender)1"="Female Officer", + "female.prop"="Female Proportion of Proximate Force", + "factor(of_gender)1:female.prop"="Female Officer * Female Prop."), + digits = 3) + +# Table 3. Stop Type +load("Data/FLSearch_StopType_OLS.RData") +load("Data/NCSearch_StopType_OLS.RData") +load("Data/FlContra_StopType_OLS.RData") +load("Data/FlSearchRate_StopType_OLS.RData") +load("Data/FlStopRate_StopType_OLS.RData") + +texreg(list(nc.search.st,fl.search.st,fl.contra.st, + contra.search.rate.st,contra.stop.rate.st), + stars=c(0.05,0.01), + custom.coef.map = list("(Intercept)"="(Intercept)", + "factor(of_gender)1"="Female Officer", + "factor(of_race)1"="Black Officer", + "officer_age"="Officer Age", + "factor(of_age)2"="Officer Age: 30-64", + "factor(of_age)3"="Officer Age: 65+", + "officer_years_of_service"="Officer Years of Service", + "Officer_Years_of_Service"="Officer Years of Service", + "factor(of_exper)1"="Experienced Officer", + "factor(race_gender)1"="White Female", + "factor(race_gender)2"="Black Male", + "factor(race_gender)3"="Black Female", + "factor(race_gender)4"="Latino Male", + "factor(race_gender)5"="Latina Female", + "subject_age"="Driver Age", + "factor(driver_age)2"="Driver Age: 30-64", + "factor(driver_age)3"="Driver Age: 65+", + "investigatory" = "Investigatory Stop Purpose", + "out_of_state"="Out of State"), + digits = 3) + +# Table 4. Driver Characteristics +load("Data/FLInter_Search.RData") +load("Data/FLInter_Contra.RData") +load("Data/FLStopRate_Inter_OLS.RData") +load("Data/FLSearchRate_Inter_OLS.RData") +load("Data/NCInter_Search.RData") + +texreg(list(nc.search.inter,fl.search.inter,fl.contra.inter, + contra.search.rate.inter,contra.stop.rate.inter), + stars=c(0.01,0.05), + custom.coef.map = list("factor(of_gender)1"="Female Officer", + "factor(subject_female)1"="Female Driver", + "factor(of_race)1"="Black Officer", + "factor(of_race)2"="Latinx Officer", + "factor(subject_race2)1"="Black Driver", + "factor(subject_race2)2"="Latinx Driver", + "factor(of_gender)1:factor(subject_female)1"="Female Officer*Driver", + "factor(of_race)1:factor(subject_race2)1"="Black Officer*Driver", + "factor(of_race)2:factor(subject_race2)1"="Latinx Officer*Black Driver", + "factor(of_race)1:factor(subject_race2)2"="Black Officer*Latinx Driver", + "factor(of_race)2:factor(subject_race2)2"="Latinx Officer* Driver"),digits=3) + +### +### 8. Appendix E: A Conservative Test with the Charlotte Police Department +### + +load("Data/NorthCarolina.RData") + +table(nc$year) + +nc.search16 = lm(search~factor(race_gender)+subject_age+ + investigatory+ + factor(of_race)+ + factor(of_gender)+Officer_Years_of_Service+ + factor(month)+ + factor(CMPD_Division), + data=nc,subset=nc$year==2016) +nc.search17 = lm(search~factor(race_gender)+subject_age+ + investigatory+ + factor(of_race)+ + factor(of_gender)+Officer_Years_of_Service+ + factor(month)+ + factor(CMPD_Division), + data=nc,subset=nc$year==2017) +nc.search19 = lm(search~factor(race_gender)+subject_age+ + investigatory+ + factor(of_race)+ + factor(of_gender)+Officer_Years_of_Service+ + factor(month)+ + factor(CMPD_Division), + data=nc,subset=nc$year==2019) +nc.search20 = lm(search~factor(race_gender)+subject_age+ + investigatory+ + factor(of_race)+ + factor(of_gender)+Officer_Years_of_Service+ + factor(month)+ + factor(CMPD_Division), + data=nc,subset=nc$year==2020) +texreg(list(nc.search16,nc.search17,nc.search19,nc.search20), + omit.coef = "Division*|month*", + custom.coef.map = list("(Intercept)"="(Intercept)", + "factor(of_gender)1"="Female Officer", + "factor(of_race)1"="Black Officer", + "Officer_Years_of_Service"="Officer Years of Service", + "investigatory"="Investigatory Stop", + "factor(race_gender)1"="White Female", + "factor(race_gender)2"="Black Male", + "factor(race_gender)3"="Black Female", + "subject_age"="Driver Age"), + stars=c(0.01,0.05)) \ No newline at end of file diff --git a/108/replication_package/Codebook.pdf b/108/replication_package/Codebook.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7622151a4e8f46379ae80b0b467c7348af926f92 --- /dev/null +++ b/108/replication_package/Codebook.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13005b9b5345b06738031cbc739cd7d498e0a522225906eabc134f6524848295 +size 100640 diff --git a/108/replication_package/Data/CMPD_Employee_Demographics-2.csv b/108/replication_package/Data/CMPD_Employee_Demographics-2.csv new file mode 100644 index 0000000000000000000000000000000000000000..ae6c97fca2d1915fa4ede895ab79376d947dca04 --- /dev/null +++ b/108/replication_package/Data/CMPD_Employee_Demographics-2.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85af7b553d7ac37b8a36be9f42f1a16b3dcb4b7b5b1e104d7e799a0162bf8717 +size 102070 diff --git a/108/replication_package/Data/FLInter_Contra.RData b/108/replication_package/Data/FLInter_Contra.RData new file mode 100644 index 0000000000000000000000000000000000000000..cb52aab704a8869ab051ccec14c620686bb660d2 --- /dev/null +++ b/108/replication_package/Data/FLInter_Contra.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e51490c9a53f92a300708b5ca2095e71d9d941e8381192e743414ec146e516d6 +size 11259261 diff --git a/108/replication_package/Data/FLInter_Search.RData b/108/replication_package/Data/FLInter_Search.RData new file mode 100644 index 0000000000000000000000000000000000000000..9f6d27508ac21afe016b5e17229680c29987e07c --- /dev/null +++ b/108/replication_package/Data/FLInter_Search.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98eaf6c3979cdfc1d254e1bf93748477ed3bead57f7c197eb35557461007563a +size 2359133801 diff --git a/108/replication_package/Data/FLSearch_Exper_OLS.RData b/108/replication_package/Data/FLSearch_Exper_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..da11832a560f54d9449cbcf4f07d304e8cbbd92c --- /dev/null +++ b/108/replication_package/Data/FLSearch_Exper_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd30c101c09a686ed202bee900a75ef7f7fb3feae40c5079433dac3907f3921b +size 2362469120 diff --git a/108/replication_package/Data/FLSearch_OLS.RData b/108/replication_package/Data/FLSearch_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..a7d17462c9b419e8cd59cb8bb0b81faee32a6697 --- /dev/null +++ b/108/replication_package/Data/FLSearch_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a1514156c43a7f692d134890d25b99bc985748700f54f540c0ba3ff26df68661 +size 2342885016 diff --git a/108/replication_package/Data/FLSearch_OLS_FE.RData b/108/replication_package/Data/FLSearch_OLS_FE.RData new file mode 100644 index 0000000000000000000000000000000000000000..d7c6c3852ca66c63ebdbdb652c9ad85498bda090 --- /dev/null +++ b/108/replication_package/Data/FLSearch_OLS_FE.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dbda980fede0640cec254d207f62567d61be8a194ef1b4abb59a6eed958c3f17 +size 178632280 diff --git a/108/replication_package/Data/FLSearch_Prop_OLS.RData b/108/replication_package/Data/FLSearch_Prop_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..5503bc2a046c729836dd02ee4e28db8c2f63d912 --- /dev/null +++ b/108/replication_package/Data/FLSearch_Prop_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd626b7947c497060e2ac5da415424c0851d990b1bbf8fd923b7f83bfd402f0d +size 2366944781 diff --git a/108/replication_package/Data/FLSearch_Sm_OLS.RData b/108/replication_package/Data/FLSearch_Sm_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..585258f2cfb00e58dac5182c19cd5117ca7a5e71 --- /dev/null +++ b/108/replication_package/Data/FLSearch_Sm_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2791ea705faa50c55af91d210f5bd2c40ba9ef1fb4f843f885be05cacdfa8723 +size 46668689 diff --git a/108/replication_package/Data/FLSearch_StopType_OLS.RData b/108/replication_package/Data/FLSearch_StopType_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..06540b3f96ca2ea384a74ee74ede9b758552d0ba --- /dev/null +++ b/108/replication_package/Data/FLSearch_StopType_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d510581a50fca4f503989fa258784e47d2dbcc6bcfaddce012947c381f6fb8e +size 1254399142 diff --git a/108/replication_package/Data/FL_Aggregated-2.RData b/108/replication_package/Data/FL_Aggregated-2.RData new file mode 100644 index 0000000000000000000000000000000000000000..68dc572b8393444752ef567cfbd11deac4e88653 --- /dev/null +++ b/108/replication_package/Data/FL_Aggregated-2.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:23f19f7224610075cc557a54c48efe0d22f8e05128d20e457aded8542ac3c269 +size 2359133 diff --git a/108/replication_package/Data/Fig1_Data-2.RData b/108/replication_package/Data/Fig1_Data-2.RData new file mode 100644 index 0000000000000000000000000000000000000000..1b271cbf56405c3ad1fefc445eafdbf42c669980 --- /dev/null +++ b/108/replication_package/Data/Fig1_Data-2.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:01489db42bc824d3c335d2992cc2928436c2a8295965d12f02a09842f6317232 +size 227 diff --git a/108/replication_package/Data/FlContra_Exper_OLS.RData b/108/replication_package/Data/FlContra_Exper_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..66841bf17c38108f45fc3d87f9b9ef7d921ff0cc --- /dev/null +++ b/108/replication_package/Data/FlContra_Exper_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a02d19de084d28d8fa52873eca1435a6a732f9e50c6a652758f2bfca9fbf3987 +size 11198225 diff --git a/108/replication_package/Data/FlContra_Logit.RData b/108/replication_package/Data/FlContra_Logit.RData new file mode 100644 index 0000000000000000000000000000000000000000..5557f1135e397603d482c5ea3e99ea4791a52c9f --- /dev/null +++ b/108/replication_package/Data/FlContra_Logit.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:409491c82c65d415ff8ef172232ca9a85a747f7b4fef9485830bd9e7bd1c29d4 +size 106097885 diff --git a/108/replication_package/Data/FlContra_OLS.RData b/108/replication_package/Data/FlContra_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..9ebf8789207f79c887966e8097c0e67482f852bc --- /dev/null +++ b/108/replication_package/Data/FlContra_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c785e578736bbf092441b223d2a48aa961502f516c2345823ec3f435a646770 +size 11001727 diff --git a/108/replication_package/Data/FlContra_OLS_FE.RData b/108/replication_package/Data/FlContra_OLS_FE.RData new file mode 100644 index 0000000000000000000000000000000000000000..bdfa8233518177b36df46c688140b197fac493d1 --- /dev/null +++ b/108/replication_package/Data/FlContra_OLS_FE.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:adc0aba7bda58b3bb62478a4a98a3cb7a75829c46bf176577ab0cd49d05fbda7 +size 1159630 diff --git a/108/replication_package/Data/FlContra_Prop_OLS.RData b/108/replication_package/Data/FlContra_Prop_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..66a7061938a9914f33aba7a84999146c80d38129 --- /dev/null +++ b/108/replication_package/Data/FlContra_Prop_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b9a91cc6baffa3d93740d5912bf7bd07ee213d265e005b6b88799457bcc0605 +size 11495685 diff --git a/108/replication_package/Data/FlContra_Sm_OLS.RData b/108/replication_package/Data/FlContra_Sm_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..80dac60b72f22bd1fe43ee683d5e52ec0d193541 --- /dev/null +++ b/108/replication_package/Data/FlContra_Sm_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:369f25d63c672d16149118b8cfed934599bcb9bd1e066ddb447496c188e9a6e4 +size 156422 diff --git a/108/replication_package/Data/FlContra_StopType_OLS.RData b/108/replication_package/Data/FlContra_StopType_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..e4694ff2b0987947023ca50a0d9733a5a7f7a68c --- /dev/null +++ b/108/replication_package/Data/FlContra_StopType_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6d48289c9409301da705fd8dc8c6d924174e4af1a9b5706ca46556d3070c1ee +size 9424568 diff --git a/108/replication_package/Data/FlSearchRate_Exper_OLS.RData b/108/replication_package/Data/FlSearchRate_Exper_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..5f7473adef56b6b3bb1526e228a5bacbb45f9605 --- /dev/null +++ b/108/replication_package/Data/FlSearchRate_Exper_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79d926b7a6f669d70c89cc90fd8346959aabc2b6dfd9e5c470f0b663ce245b1c +size 430999 diff --git a/108/replication_package/Data/FlSearchRate_Inter_OLS.RData b/108/replication_package/Data/FlSearchRate_Inter_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..01df5ad3ebd609914d0aacebaa524c3db640bb33 --- /dev/null +++ b/108/replication_package/Data/FlSearchRate_Inter_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:331839e877eb0a2bf8b6c607d08dd85f4aadab9e4c044cb4322d8547fdccd5b5 +size 681337 diff --git a/108/replication_package/Data/FlSearchRate_OLS.RData b/108/replication_package/Data/FlSearchRate_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..28b615f94b905b1561b4afc6f66e3918ae2b3f33 --- /dev/null +++ b/108/replication_package/Data/FlSearchRate_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f15fefc7c3a7e6472994b9afe5db12d8c59827abaf50cccad1d20f9c66e854de +size 664257 diff --git a/108/replication_package/Data/FlSearchRate_OLS_FE.RData b/108/replication_package/Data/FlSearchRate_OLS_FE.RData new file mode 100644 index 0000000000000000000000000000000000000000..7ea48b0188d7af5825fac8cfae9e3dc62d1350c5 --- /dev/null +++ b/108/replication_package/Data/FlSearchRate_OLS_FE.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90c3648d7ac25842d2aaa1809a2427ab28d5558238fbbccf9d7c2f9427a1b60f +size 715255 diff --git a/108/replication_package/Data/FlSearchRate_StopType_OLS.RData b/108/replication_package/Data/FlSearchRate_StopType_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..65a287564e25e66eb57b49e6a117d3d247be1b8a --- /dev/null +++ b/108/replication_package/Data/FlSearchRate_StopType_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08093ceb38bc2d279479419d0670d772f906c998318f557352df08bb92302dac +size 301641 diff --git a/108/replication_package/Data/FlStopRate_Exper_OLS.RData b/108/replication_package/Data/FlStopRate_Exper_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..e831c450ae44e3c9bc7844e36d4b2b4958d77306 --- /dev/null +++ b/108/replication_package/Data/FlStopRate_Exper_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48b7b5bbf65240de3142009835bf0a3665ce97c3543d20609554e6365820aa4c +size 13569388 diff --git a/108/replication_package/Data/FlStopRate_Inter_OLS.RData b/108/replication_package/Data/FlStopRate_Inter_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..952cdc74b56560fda10c433e01f62e926d27f4f9 --- /dev/null +++ b/108/replication_package/Data/FlStopRate_Inter_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0d73e384cb9b7cc1e37e8e3672fea953045583ff5310394d74451a04f4dd67a +size 20515466 diff --git a/108/replication_package/Data/FlStopRate_OLS.RData b/108/replication_package/Data/FlStopRate_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..758be875bfde0261c837f45c5e1ab392a226083e --- /dev/null +++ b/108/replication_package/Data/FlStopRate_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85bd75b8f6f9bf0144874d7dd572a1776a7ac4b3a604582899eccd2075aab288 +size 16239663 diff --git a/108/replication_package/Data/FlStopRate_OLS_FE.RData b/108/replication_package/Data/FlStopRate_OLS_FE.RData new file mode 100644 index 0000000000000000000000000000000000000000..a43ed867ccab9b932c83d0a24858152ed2dc3460 --- /dev/null +++ b/108/replication_package/Data/FlStopRate_OLS_FE.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:590e1874612b47f5fb3cac2b0812b2f0546688f55276abcaa587ad35923fcd6f +size 31466666 diff --git a/108/replication_package/Data/FlStopRate_StopType_OLS.RData b/108/replication_package/Data/FlStopRate_StopType_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..4381bc87a7d1a5fa04a760f4eb0a3c4bb918beb0 --- /dev/null +++ b/108/replication_package/Data/FlStopRate_StopType_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:006a600056a5370ac28e5c6e06803f01d574354c51e4e95c3c7792ebc3200dc9 +size 6480541 diff --git a/108/replication_package/Data/FloridaLarge.RData b/108/replication_package/Data/FloridaLarge.RData new file mode 100644 index 0000000000000000000000000000000000000000..a0f8676f358e02fd51e376f3aa91e47219e037d1 --- /dev/null +++ b/108/replication_package/Data/FloridaLarge.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fcb05c938fd8f1c03d10c470fa7798c0b96fe1ba479feffcb5122bb88ffc91fc +size 162447547 diff --git a/108/replication_package/Data/FloridaSmall.RData b/108/replication_package/Data/FloridaSmall.RData new file mode 100644 index 0000000000000000000000000000000000000000..73702d6e525171191cfbd09f74de837674a9b932 --- /dev/null +++ b/108/replication_package/Data/FloridaSmall.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:348f5b056d7723726c70ee0bd06272d23c6aaa8d7a086e76b4f886c8a41bbaff +size 93337267 diff --git a/108/replication_package/Data/NCInter_Search.RData b/108/replication_package/Data/NCInter_Search.RData new file mode 100644 index 0000000000000000000000000000000000000000..22c781616a17a61dc3f4069df6b43b1e402f5d40 --- /dev/null +++ b/108/replication_package/Data/NCInter_Search.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:23ee3c85f8545c110d7141dc5993c9ca088c51feb16dfe7045e1f6d0a8e49c94 +size 46453455 diff --git a/108/replication_package/Data/NCSearch_Exper_OLS.RData b/108/replication_package/Data/NCSearch_Exper_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..17d52908fec5dc8a6985fed523d3da34a53ab6ae --- /dev/null +++ b/108/replication_package/Data/NCSearch_Exper_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c97944fa5c25668536b01df9667a86e8c61728724357667c3c9b3a51cb359697 +size 35200154 diff --git a/108/replication_package/Data/NCSearch_Logit.RData b/108/replication_package/Data/NCSearch_Logit.RData new file mode 100644 index 0000000000000000000000000000000000000000..a2c4107d8f674eb1d88163228846a425726ecc1d --- /dev/null +++ b/108/replication_package/Data/NCSearch_Logit.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:195ae828e4eca39ffc3b12d04c45bb53461edfa5c1877804b77602d462b27f5b +size 50326018 diff --git a/108/replication_package/Data/NCSearch_OLS.RData b/108/replication_package/Data/NCSearch_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..78fe005a8c28f1309764c2c3075835ff3f9b824e --- /dev/null +++ b/108/replication_package/Data/NCSearch_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:43cc344a20dc09fbb4afad6735fee82fb158c6340c133bf2936f3aa1c462bb8d +size 34108717 diff --git a/108/replication_package/Data/NCSearch_Sm_OLS.RData b/108/replication_package/Data/NCSearch_Sm_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..6c8f2914f50cc4055962a18b7c52c1706fa10ee9 --- /dev/null +++ b/108/replication_package/Data/NCSearch_Sm_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1073b27ffcebae9427223fe79419f75bf62958e9566a73028f8050d3d0713fd +size 220878 diff --git a/108/replication_package/Data/NCSearch_StopType_OLS.RData b/108/replication_package/Data/NCSearch_StopType_OLS.RData new file mode 100644 index 0000000000000000000000000000000000000000..ae82fbd085d4e088f1ef8194c874a498e1d9310e --- /dev/null +++ b/108/replication_package/Data/NCSearch_StopType_OLS.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98d7812f9bb368364fefeb839b0b3f86019f2d56ffc3585a92e4fa71d58ba810 +size 17400474 diff --git a/108/replication_package/Data/NorthCarolina.RData b/108/replication_package/Data/NorthCarolina.RData new file mode 100644 index 0000000000000000000000000000000000000000..87241171b76b430cd7ea1cc3c63da239ec4adce7 --- /dev/null +++ b/108/replication_package/Data/NorthCarolina.RData @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a6642b5def9756e49bd99c4ce1610048fd27bf5617c78aec3d658a5ca431422 +size 2821239 diff --git a/108/replication_package/Data/Officer_Traffic_Stops_Original.csv b/108/replication_package/Data/Officer_Traffic_Stops_Original.csv new file mode 100644 index 0000000000000000000000000000000000000000..3522b54f4072ea0222f211e5e85e9bd6fcb1ed59 --- /dev/null +++ b/108/replication_package/Data/Officer_Traffic_Stops_Original.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:804a8c1ac803fcac70319b898e0a75dbbc705da548cb26cc0641b287aa184def +size 17327975 diff --git a/108/replication_package/Data/Officer_Traffic_Stops_Update.csv b/108/replication_package/Data/Officer_Traffic_Stops_Update.csv new file mode 100644 index 0000000000000000000000000000000000000000..a1b581e27af5c07a1fe3f6197c022947b7819ee0 --- /dev/null +++ b/108/replication_package/Data/Officer_Traffic_Stops_Update.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d2e1b647ba0739d6ff13e28ba0378ef4af8b8cc41f584038e39761a48a574c8 +size 20913993 diff --git a/108/replication_package/Data/fl_statewide_2019_08_13.csv b/108/replication_package/Data/fl_statewide_2019_08_13.csv new file mode 100644 index 0000000000000000000000000000000000000000..c1c2c57f3f856f6ec849040f987e678824c1d13a --- /dev/null +++ b/108/replication_package/Data/fl_statewide_2019_08_13.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd8bd39618a6f670122723eeafa9d11ba7f19065eda4fadb38ffdacc838f16db +size 1974334914 diff --git a/108/replication_package/Figures/Fig1_PredProb.png b/108/replication_package/Figures/Fig1_PredProb.png new file mode 100644 index 0000000000000000000000000000000000000000..470d964249df67b7dbe57cbfe147b5092d312479 --- /dev/null +++ b/108/replication_package/Figures/Fig1_PredProb.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b04006e4b3822e53a76a827780a000d2ceb711c7c0915fb54cd1e6bdf6158d01 +size 22319 diff --git a/108/replication_package/Figures/Fig2_PredProb.png b/108/replication_package/Figures/Fig2_PredProb.png new file mode 100644 index 0000000000000000000000000000000000000000..3e58fe13d88e902d3f657cbf8c506c809829f6ec --- /dev/null +++ b/108/replication_package/Figures/Fig2_PredProb.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4bd4a047496b785d9499a301333c4ce883102d777bec8cf35f9e7e3048cfde1 +size 31355 diff --git a/108/replication_package/OutputFiles/Step1_MainAnalysisAndData.html b/108/replication_package/OutputFiles/Step1_MainAnalysisAndData.html new file mode 100644 index 0000000000000000000000000000000000000000..b06d3661a37d0fe0d0b7e302e7449311910bf145 --- /dev/null +++ b/108/replication_package/OutputFiles/Step1_MainAnalysisAndData.html @@ -0,0 +1,778 @@ + + + + + + + + + + + + + + + +Step1_MainAnalysisAndData.R + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
#######
+#######
+####### Replication files for Do Women Officers Police Differently? Evidence from Traffic Stops
+####### This file cleans the raw data and runs the analysis for the body of the paper. 
+####### Last Updated: Jan. 2021
+#######
+#######
+
+
+###
+### 1. Setting up the space. 
+###
+
+# Setting the working directory:
+setwd("~/Desktop/PinkPolicing/AJPS_ReplicationFiles")
+
+# Installing the needed libraries:
+#install.packages("pscl",dependencies = T)
+#install.packages("ggplot2",dependencies = T)
+#install.packages("texreg",dependencies = T)
+#install.packages("readr",dependencies = T)
+#install.packages("arm",dependencies = T)
+#install.packages("dplyr",dependencies = T)
+
+# Opening up those libraries:
+library(dplyr)
+
## 
+## Attaching package: 'dplyr'
+
## The following objects are masked from 'package:stats':
+## 
+##     filter, lag
+
## The following objects are masked from 'package:base':
+## 
+##     intersect, setdiff, setequal, union
+
library(ggplot2)
+library(texreg)
+
## Version:  1.37.5
+## Date:     2020-06-17
+## Author:   Philip Leifeld (University of Essex)
+## 
+## Consider submitting praise using the praise or praise_interactive functions.
+## Please cite the JSS article in your publications -- see citation("texreg").
+
library(readr)
+library(pscl)
+
## Classes and Methods for R developed in the
+## Political Science Computational Laboratory
+## Department of Political Science
+## Stanford University
+## Simon Jackman
+## hurdle and zeroinfl functions by Achim Zeileis
+
library(arm)
+
## Loading required package: MASS
+
## 
+## Attaching package: 'MASS'
+
## The following object is masked from 'package:dplyr':
+## 
+##     select
+
## Loading required package: Matrix
+
## Loading required package: lme4
+
## 
+## arm (Version 1.11-2, built: 2020-7-27)
+
## Working directory is /Users/kelseyshoub/Desktop/PinkPolicing/AJPS_ReplicationFiles
+
# Loading the raw data:
+nc_new = read_csv("Data/Officer_Traffic_Stops_Update.csv")
+
## 
+## ── Column specification ────────────────────────────────────────────────────────────────────────────────────
+## cols(
+##   OBJECTID = col_double(),
+##   Month_of_Stop = col_character(),
+##   Reason_for_Stop = col_character(),
+##   Officer_Race = col_character(),
+##   Officer_Gender = col_character(),
+##   Officer_Years_of_Service = col_double(),
+##   Driver_Race = col_character(),
+##   Driver_Ethnicity = col_character(),
+##   Driver_Gender = col_character(),
+##   Driver_Age = col_double(),
+##   Was_a_Search_Conducted = col_character(),
+##   Result_of_Stop = col_character(),
+##   CMPD_Division = col_character(),
+##   GlobalID = col_character()
+## )
+
nc_old = read_csv("Data/Officer_Traffic_Stops_Original.csv")
+
## 
+## ── Column specification ────────────────────────────────────────────────────────────────────────────────────
+## cols(
+##   Month_of_Stop = col_character(),
+##   Reason_for_Stop = col_character(),
+##   Officer_Race = col_character(),
+##   Officer_Gender = col_character(),
+##   Officer_Years_of_Service = col_double(),
+##   Driver_Race = col_character(),
+##   Driver_Ethnicity = col_character(),
+##   Driver_Gender = col_character(),
+##   Driver_Age = col_double(),
+##   Was_a_Search_Conducted = col_character(),
+##   Result_of_Stop = col_character(),
+##   CMPD_Division = col_character(),
+##   ObjectID = col_double(),
+##   CreationDate = col_datetime(format = ""),
+##   Creator = col_character(),
+##   EditDate = col_datetime(format = ""),
+##   Editor = col_character()
+## )
+
nc = bind_rows(nc_new,nc_old)
+fl = read_csv("Data/fl_statewide_2019_08_13.csv")
+
## 
+## ── Column specification ────────────────────────────────────────────────────────────────────────────────────
+## cols(
+##   .default = col_character(),
+##   date = col_date(format = ""),
+##   time = col_time(format = ""),
+##   subject_age = col_double(),
+##   officer_age = col_double(),
+##   officer_years_of_service = col_double(),
+##   arrest_made = col_logical(),
+##   citation_issued = col_logical(),
+##   warning_issued = col_logical(),
+##   frisk_performed = col_logical(),
+##   search_conducted = col_logical()
+## )
+## ℹ Use `spec()` for the full column specifications.
+
###
+### 2. Producing the data sets for each table. 
+###
+
+# Cleaning the NC Data
+nc$driver_re = as.numeric(ifelse(nc$Driver_Race=="White"&
+                                   nc$Driver_Ethnicity=="Non-Hispanic","0",
+                                 ifelse(nc$Driver_Race=="Black"&
+                                          nc$Driver_Ethnicity=="Non-Hispanic","1",
+                                        ifelse(nc$Driver_Ethnicity=="Hispanic","2",NA))))
+nc$of_rg = ifelse(nc$Officer_Race=="White",
+                  ifelse(nc$Officer_Gender=="Male","0","1"),
+                  ifelse(nc$Officer_Race=="Black/African American",
+                         ifelse(nc$Officer_Gender=="Male","2","3"),NA))
+nc$of_race = ifelse(nc$Officer_Race=="White",0,
+                    ifelse(nc$Officer_Race=="Black/African American",1,NA))
+nc$of_gender = ifelse(nc$Officer_Gender=="Male","0","1")
+nc$investigatory = ifelse(grepl("Impaired|Speeding|Light|Movement",
+                                as.character(nc$Reason_for_Stop)),0,1)
+nc$investigatory = ifelse(grepl("Check",as.character(nc$Reason_for_Stop)),
+                          NA,nc$investigatory)
+nc$race_gender = ifelse(nc$driver_re=="0",
+                        ifelse(nc$Driver_Gender=="Male","0","1"),
+                        ifelse(nc$driver_re=="1",
+                               ifelse(nc$Driver_Gender=="Male","2","3"),NA))
+nc$search = ifelse(nc$Was_a_Search_Conducted=="Yes",1,0)
+
+nc$subject_sex = tolower(nc$Driver_Gender)
+nc$subject_age = nc$Driver_Age
+nc$officer_sex = tolower(nc$Officer_Gender)
+nc$month = apply(as.matrix(as.character(nc$Month_of_Stop)),1,
+                 function(x){strsplit(x,"/",fixed=T)[[1]][2]})
+nc$year = apply(as.matrix(as.character(nc$Month_of_Stop)),1,
+                function(x){strsplit(x,"/",fixed=T)[[1]][1]})
+
+nc$arrest = ifelse(nc$Result_of_Stop=="Arrest",1,0)
+save(nc,file="Data/NorthCarolina.RData")
+
+# Cleaning the FL data.
+violations_list = strsplit(paste(fl$reason_for_stop,collapse = "|"),"|",fixed = T)
+violations_list_small = unique(violations_list[[1]])[2:71]
+violations_indicator = violations_list_small[c(1,2,5,6,7,9,10,14,19,
+                                               20,23,40,45)]
+fl$investigatory = ifelse(is.na(fl$violation),NA,
+                          ifelse(fl$violation %in% violations_indicator, 0, 1))
+fl$contraband_found = ifelse(grepl("contraband",
+                                   tolower(fl$violation)),1,0)
+fl$race_gender = ifelse(fl$subject_race=="white",
+                        ifelse(fl$subject_sex=="male",0,1),
+                        ifelse(fl$subject_race=="black",
+                               ifelse(fl$subject_sex=="male",2,3),
+                               ifelse(fl$subject_race=="hispanic",
+                                      ifelse(fl$subject_sex=="male",4,5),NA)))
+fl$of_rg = ifelse(fl$officer_race=="white",
+                  ifelse(fl$officer_sex=="male",0,1),
+                  ifelse(fl$officer_race=="black",
+                         ifelse(fl$officer_sex=="male",2,3),
+                         ifelse(fl$officer_race=="hispanic",
+                                ifelse(fl$officer_sex=="male",4,5),NA)))
+fl$of_race = ifelse(fl$officer_race=="white",0,
+                    ifelse(fl$officer_race=="black",1,
+                           ifelse(fl$officer_race=="hispanic",2,
+                                  ifelse(fl$officer_race=="asian/pacific islander",3,
+                                         ifelse(fl$officer_race=="other",4,NA)))))
+fl$of_gender = ifelse(fl$officer_sex=="male",0,1)
+fl$out_of_state = ifelse(fl$vehicle_registration_state=="FL",0,1)
+fl$hour_of_day = apply(as.matrix(as.character(fl$time)),1,
+                       function(x)(strsplit(x,":",fixed = T)[[1]][1]))
+fl$month = apply(as.matrix(as.character(fl$date)),1,
+                 function(x)(paste(strsplit(x,"-",fixed = T)[[1]][2],
+                                   collapse = "_")))
+fl$year = apply(as.matrix(as.character(fl$date)),1,
+                function(x)(paste(strsplit(x,"-",fixed = T)[[1]][1],
+                                  collapse = "_")))
+fl = subset(fl,fl$year!="2016"&fl$year!="2017"&fl$year!="2018") #Narrows down to complete years that don't report extreme misingness on key outcome. 
+fl.officers = names(table(fl$officer_id_hash))[table(fl$officer_id_hash)>1000]
+fl$officers_include = ifelse(fl$officer_id_hash%in%fl.officers,1,0)
+fl.counties = names(table(fl$county_name))[table(fl$county_name)>1000]
+fl$county_include = ifelse(fl$county_name%in%fl.counties,1,0)
+fl.ag.id = aggregate(fl$of_gender,
+                     list(fl$officer_id_hash,fl$year,fl$county_name),
+                     mean)
+fl.ag.id$officer = ifelse(!is.na(fl.ag.id$x),1,0)
+fl.ag.gender = aggregate(fl.ag.id[,c("x","officer")],
+                         list(fl.ag.id$Group.2,fl.ag.id$Group.3),
+                         sum,na.rm=T)
+fl.ag.gender$prop.female = fl.ag.gender$x/fl.ag.gender$officer
+colnames(fl.ag.gender) = c("year","county_name","count.female","tot.officer","prop.female")
+fl = merge(fl,fl.ag.gender,by=c("year","county_name"),all.x=T)
+fl$officer_exclude = ifelse(fl$officer_years_of_service<0|fl$officer_years_of_service>40,1,0)
+fl.ag.id2 = aggregate(fl$of_gender,
+                      list(fl$officer_id_hash),
+                      mean)
+fl$search_occur = ifelse(fl$search_conducted == 0, 0, 
+                         ifelse(fl$search_basis != "other",1,NA))
+fl$contra = ifelse(is.na(fl$search_occur),0,
+                   ifelse(fl$search_occur==1,fl$contraband_found,0))
+
+complete = complete.cases(fl[,c("search_occur","race_gender","subject_age",
+                                "out_of_state","investigatory","of_gender",
+                                "of_race","officer_years_of_service","officer_age",
+                                "hour_of_day","month","year","county_name")])
+fl.sm = fl[complete,]
+complete2 = complete.cases(fl[,c("search_occur","of_gender")])
+table(complete)
+
## complete
+##   FALSE    TRUE 
+## 2111746 2731204
+
table(complete2)
+
## complete2
+##   FALSE    TRUE 
+##  692067 4150883
+
fl.missingness = apply(fl[,c("search_occur","race_gender","subject_age",
+                             "out_of_state","investigatory","of_gender",
+                             "of_race","officer_years_of_service","officer_age",
+                             "county_name")],
+                       2,
+                       FUN = function(x){table(is.na(x))})
+save(fl,file="Data/FloridaLarge.RData")
+save(fl.sm,file="Data/FloridaSmall.RData")
+
+fl$stops = ifelse(!is.na(fl$search_occur),1,0)
+fl$contra.ttest = ifelse(fl$search_occur==1,fl$contra,NA)
+prop.test(table(fl$of_gender,fl$contra.ttest))
+
## 
+##  2-sample test for equality of proportions with continuity correction
+## 
+## data:  table(fl$of_gender, fl$contra.ttest)
+## X-squared = 16.681, df = 1, p-value = 4.423e-05
+## alternative hypothesis: two.sided
+## 95 percent confidence interval:
+##  0.05554105 0.17724120
+## sample estimates:
+##    prop 1    prop 2 
+## 0.7009499 0.5845588
+
fl$of_exper = ifelse(fl$officer_years_of_service>=
+                       mean(fl$officer_years_of_service,na.rm=T),1,0)
+fl$of_age = ifelse(fl$officer_age<30,1,
+                   ifelse(fl$officer_age>64,3,2))
+fl$driver_age = ifelse(fl$subject_age<30,1,
+                       ifelse(fl$subject_age>64,3,2))
+fl$hour_of_day2 = as.numeric(fl$hour_of_day)
+fl$tod = ifelse(fl$hour_of_day2<3,1,
+                ifelse(fl$hour_of_day2<6,2,
+                       ifelse(fl$hour_of_day2<9,3,
+                              ifelse(fl$hour_of_day2<12,4,
+                                     ifelse(fl$hour_of_day2<15,5,
+                                            ifelse(fl$hour_of_day2<18,6,
+                                                   ifelse(fl$hour_of_day2<21,7,8)))))))
+
+fl.ag.officers = aggregate(fl[,c("stops","search_occur","contra")],
+                           by=list(fl$officer_id_hash,
+                                   fl$of_race,fl$of_gender,
+                                   fl$of_exper,fl$of_age,
+                                   fl$race_gender,fl$driver_age,
+                                   fl$out_of_state,fl$investigatory,
+                                   fl$year,fl$tod),
+                           sum,na.rm=T)
+colnames(fl.ag.officers) = c("officer_id","of_race","of_gender","of_exper",
+                             "of_age","race_gender","driver_age",
+                             "out_of_state","investigatory","year",
+                             "tod","stops","search_occur","contra")
+fl.ag.officers$contra.search.rate = (fl.ag.officers$contra/fl.ag.officers$search_occur)*10
+fl.ag.officers$contra.stop.rate = (fl.ag.officers$contra/fl.ag.officers$stops)*100
+save(fl.ag.officers,file="Data/FL_Aggregated.RData")
+
+# Data for Figure 1
+search.df = data.frame("Department" = c("CPD","CPD","FHP","FHP"),
+                       "Gender" = c("Male","Female","Male","Female"),
+                       "Rate" = c(prop.table(table(nc$of_gender,nc$search),1)[,2],
+                                  prop.table(table(fl$of_gender[fl.sm$county_include==1&
+                                                                  fl.sm$officer_exclude==0],
+                                                   fl$search_occur[fl.sm$county_include==1&
+                                                                     fl.sm$officer_exclude==0]),1)[,2]))
+save(search.df,file="Data/Fig1_Data.RData")
+
+###
+### 3. Regressions
+###
+
+#
+# For the Main Text:
+#
+
+# Search Regressions
+fl.search.sm = lm(search_occur~factor(of_gender),data=fl)
+save(fl.search.sm, file="Data/FLSearch_Sm_OLS.RData")
+fl.search = lm(search_occur~factor(race_gender)+
+                 subject_age+out_of_state+
+                 investigatory+
+                 factor(of_gender)+factor(of_race)+
+                 officer_years_of_service+officer_age+
+                 factor(hour_of_day)+factor(month)+factor(year)+
+                 factor(county_name),
+               data=fl.sm,  
+               subset=fl.sm$county_include==1&fl.sm$officer_exclude==0)
+save(fl.search,file="Data/FLSearch_OLS.RData")
+nc.search.sm = lm(search~factor(of_gender),data = nc)
+save(nc.search.sm,file="Data/NCSearch_Sm_OLS.RData")
+nc.search = lm(search~factor(race_gender)+subject_age+
+                 investigatory+
+                 factor(of_race)+
+                 factor(of_gender)+Officer_Years_of_Service+
+                 factor(month)+factor(year)+
+                 factor(CMPD_Division),
+               data=nc)
+save(nc.search,file="Data/NCSearch_OLS.RData")
+
+# Contraband Regressions
+fl.contra = lm(contra~factor(race_gender)+
+                 subject_age+out_of_state+
+                 investigatory+
+                 factor(of_gender)+factor(of_race)+
+                 officer_years_of_service+officer_age+
+                 factor(hour_of_day)+factor(month)+factor(year)+
+                 factor(county_name),
+               data=fl.sm,  
+               subset=fl.sm$county_include==1&
+                 fl.sm$search_occur==1&
+                 fl.sm$officer_exclude==0)
+save(fl.contra,file="Data/FlContra_OLS.RData")
+contra.search.rate.reg = lm(contra.search.rate ~ factor(of_gender) + factor(of_exper) + 
+                              factor(of_age) +factor(of_race) +
+                              factor(race_gender) + factor(driver_age)+ 
+                              investigatory + out_of_state +
+                              factor(year)+factor(tod),
+                            data=fl.ag.officers,
+                            subset=fl.ag.officers$search_occur>0)
+save(contra.search.rate.reg,file="Data/FlSearchRate_OLS.RData")
+contra.stop.rate.reg = lm(contra.stop.rate ~ factor(of_gender) + factor(of_exper) + 
+                            factor(of_age) + factor(of_race) +
+                            factor(race_gender) + factor(driver_age)+ 
+                            investigatory + out_of_state +
+                            factor(year)+factor(tod),
+                          data=fl.ag.officers)
+save(contra.stop.rate.reg,file="Data/FlStopRate_OLS.RData")
+ + + + +
+ + + + + + + + + + + + + + + diff --git a/108/replication_package/OutputFiles/Step2_AppendixAnalysis.html b/108/replication_package/OutputFiles/Step2_AppendixAnalysis.html new file mode 100644 index 0000000000000000000000000000000000000000..0bddfdd2bb817821c4a88d04385e8558aa3728ab --- /dev/null +++ b/108/replication_package/OutputFiles/Step2_AppendixAnalysis.html @@ -0,0 +1,772 @@ + + + + + + + + + + + + + + + +Step2_AppendixAnalysis.R + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
#######
+#######
+####### Replication files for Do Women Officers Police Differently? Evidence from Traffic Stops
+####### This file runs most of the supplemental regressions shown in the appendix.
+####### Last Updated: Jan. 2021
+#######
+#######
+
+# Opening up those libraries:
+library(dplyr)
+
## 
+## Attaching package: 'dplyr'
+
## The following objects are masked from 'package:stats':
+## 
+##     filter, lag
+
## The following objects are masked from 'package:base':
+## 
+##     intersect, setdiff, setequal, union
+
library(ggplot2)
+library(texreg)
+
## Version:  1.37.5
+## Date:     2020-06-17
+## Author:   Philip Leifeld (University of Essex)
+## 
+## Consider submitting praise using the praise or praise_interactive functions.
+## Please cite the JSS article in your publications -- see citation("texreg").
+
library(readr)
+library(pscl)
+
## Classes and Methods for R developed in the
+## Political Science Computational Laboratory
+## Department of Political Science
+## Stanford University
+## Simon Jackman
+## hurdle and zeroinfl functions by Achim Zeileis
+
library(arm)
+
## Loading required package: MASS
+
## 
+## Attaching package: 'MASS'
+
## The following object is masked from 'package:dplyr':
+## 
+##     select
+
## Loading required package: Matrix
+
## Loading required package: lme4
+
## 
+## arm (Version 1.11-2, built: 2020-7-27)
+
## Working directory is /Users/kelseyshoub/Desktop/PinkPolicing/AJPS_ReplicationFiles/ReplicationCode
+
# Setting the working directory:
+setwd("~/Desktop/PinkPolicing/AJPS_ReplicationFiles")
+
+#
+# Appendix: Alternative Specifications
+#
+
+# Clearing the workspace.
+rm(list = ls())
+
+# Loading in the Data
+load("Data/FloridaSmall.RData")
+load("Data/FL_Aggregated.RData")
+
+# FE for Officer 
+fl.search = lmer(search_occur~factor(race_gender)+
+                   subject_age+out_of_state+
+                   investigatory+
+                   factor(of_gender)+factor(of_race)+
+                   officer_years_of_service+officer_age+
+                   factor(hour_of_day)+factor(month)+factor(year)+
+                   factor(county_name)+(1|officer_id_hash),
+                 data=fl.sm,  
+                 subset=fl.sm$county_include==1&fl.sm$officer_exclude==0)
+save(fl.search,file="Data/FLSearch_OLS_FE.RData")
+fl.contra = lmer(contra~factor(race_gender)+
+                   subject_age+out_of_state+
+                   investigatory+
+                   factor(of_gender)+factor(of_race)+
+                   officer_years_of_service+officer_age+
+                   factor(hour_of_day)+factor(month)+factor(year)+factor(county_name)+
+                   (1|officer_id_hash),
+                 data=fl.sm,  
+                 subset=fl.sm$county_include==1&
+                   fl.sm$search_occur==1&
+                   fl.sm$officer_exclude==0)
+save(fl.contra,file="Data/FlContra_OLS_FE.RData")
+contra.search.rate.reg = lmer(contra.search.rate ~ factor(of_gender) + factor(of_exper) + 
+                                factor(of_age) +factor(of_race) +
+                                factor(race_gender) + factor(driver_age)+ 
+                                investigatory + out_of_state +
+                                factor(year)+factor(tod)+
+                                (1|officer_id),
+                              data=fl.ag.officers,
+                              subset=fl.ag.officers$search_occur>0)
+save(contra.search.rate.reg,file="Data/FlSearchRate_OLS_FE.RData")
+contra.stop.rate.reg = lmer(contra.stop.rate ~ factor(of_gender) + factor(of_exper) + 
+                              factor(of_age) + factor(of_race) +
+                              factor(race_gender) + factor(driver_age)+ 
+                              investigatory + out_of_state +
+                              factor(year)+factor(tod)+(1|officer_id),
+                            data=fl.ag.officers)
+save(contra.stop.rate.reg,file="Data/FlStopRate_OLS_FE.RData")
+
+# Logistc Regressions
+rm(list = ls())
+
+load("Data/NorthCarolina.RData")
+load("Data/FloridaSmall.RData")
+
+fl.search = glm(search_occur~factor(race_gender)+
+                  subject_age+out_of_state+
+                  investigatory+
+                  factor(of_gender)+factor(of_race)+
+                  officer_years_of_service+officer_age+
+                  factor(hour_of_day)+factor(month)+factor(year)+
+                  factor(county_name),
+                data=fl.sm,family="binomial",
+                subset=fl.sm$county_include==1&fl.sm$officer_exclude==0)
+save(fl.search,file="Data/FLSearch_Logit.RData")
+nc.search = glm(search~factor(race_gender)+subject_age+
+                  investigatory+
+                  factor(of_race)+
+                  factor(of_gender)+Officer_Years_of_Service+
+                  factor(month)+factor(year)+
+                  factor(CMPD_Division),
+                family="binomial",
+                data=nc)
+save(nc.search,file="Data/NCSearch_Logit.RData")
+fl.contra = glm(contra~factor(race_gender)+
+                  subject_age+out_of_state+
+                  investigatory+
+                  factor(of_gender)+factor(of_race)+
+                  officer_years_of_service+officer_age+
+                  factor(hour_of_day)+factor(month)+factor(year)+
+                  factor(county_name),
+                data=fl.sm, family = "binomial",
+                subset=fl.sm$county_include==1&
+                  fl.sm$search_occur==1&
+                  fl.sm$officer_exclude==0)
+save(fl.contra,file="Data/FlContra_Logit.RData")
+
+
+#
+# Appendix: Interaction Models
+#
+
+rm(list = ls())
+
+load("Data/NorthCarolina.RData")
+load("Data/FloridaSmall.RData")
+load("Data/FloridaLarge.RData")
+load("Data/FL_Aggregated.RData")
+
+
+# Experience
+fl.search.exper = lm(search_occur~factor(race_gender)+
+                       subject_age+out_of_state+
+                       investigatory+factor(of_race)+
+                       factor(of_gender)*officer_years_of_service+officer_age+
+                       factor(hour_of_day)+factor(month)+factor(year)+
+                       factor(county_name),
+                     data=fl.sm,  
+                     subset=fl.sm$county_include==1&fl.sm$officer_exclude==0)
+save(fl.search.exper,file="Data/FLSearch_Exper_OLS.RData")
+nc.search.exper = lm(search~factor(race_gender)+subject_age+
+                       investigatory+factor(of_race)+
+                       factor(of_gender)*Officer_Years_of_Service+
+                       factor(month)+factor(year)+
+                       factor(CMPD_Division),
+                     data=nc)
+save(nc.search.exper,file="Data/NCSearch_Exper_OLS.RData")
+fl.contra.exper = lm(contra~factor(race_gender)+
+                       subject_age+out_of_state+
+                       investigatory+factor(of_gender)*officer_years_of_service+
+                       factor(of_race)+officer_age+
+                       factor(hour_of_day)+factor(month)+factor(year)+
+                       factor(county_name),
+                     data=fl.sm,  
+                     subset=fl.sm$county_include==1&
+                       fl.sm$search_occur==1&
+                       fl.sm$officer_exclude==0)
+save(fl.contra.exper,file="Data/FlContra_Exper_OLS.RData")
+contra.search.rate.exper = lm(contra.search.rate ~ factor(of_gender)*factor(of_exper) + 
+                                investigatory+factor(of_age) +factor(of_race) +
+                                factor(race_gender) + factor(driver_age)+ 
+                                out_of_state +
+                                factor(year),
+                              data=fl.ag.officers,
+                              subset=fl.ag.officers$search_occur>0)
+save(contra.search.rate.exper,file="Data/FlSearchRate_Exper_OLS.RData")
+contra.stop.rate.exper = lm(contra.stop.rate ~ factor(of_gender)*factor(of_exper) + 
+                              investigatory+
+                              factor(of_age) +factor(of_race) +
+                              factor(race_gender) + factor(driver_age)+ 
+                              out_of_state +
+                              factor(year),
+                            data=fl.ag.officers)
+save(contra.stop.rate.exper,file="Data/FlStopRate_Exper_OLS.RData")
+
+# Prop Female
+fl$male.officer = ifelse(fl$of_gender==1,0,1)
+fl.ag = aggregate(fl$officer_id_hash,
+                  by=list(fl$of_gender,fl$county_name,fl$year),
+                  function(x){length(unique(x))})
+fl.ag.m = fl.ag[fl.ag$Group.1==0,]
+fl.ag.f = fl.ag[fl.ag$Group.1==1,]
+colnames(fl.ag.m)=c("male","county_name","year","male.count")
+colnames(fl.ag.f)=c("female","county_name","year","female.count")
+fl.ag = merge(fl.ag.m,fl.ag.f,all=T)
+fl.ag$male.count[is.na(fl.ag$male.count)] = 0
+fl.ag$female.count[is.na(fl.ag$female.count)] = 0
+fl.ag$female.prop = fl.ag$female.count/(fl.ag$female.count+fl.ag$male.count)
+summary(fl.ag$female.prop)
+
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
+## 0.00000 0.05042 0.07937 0.08078 0.10526 1.00000
+
fl.sm = merge(fl.sm,fl.ag)
+fl.search.prop = lm(search_occur~factor(race_gender)+
+                      subject_age+out_of_state+
+                      investigatory+factor(of_race)+
+                      factor(of_gender)*female.prop+officer_years_of_service+officer_age+
+                      factor(hour_of_day)+factor(month)+factor(year)+
+                      factor(county_name),
+                    data=fl.sm,  
+                    subset=fl.sm$county_include==1&fl.sm$officer_exclude==0)
+save(fl.search.prop,file="Data/FLSearch_Prop_OLS.RData")
+fl.contra.prop = lm(contra~factor(race_gender)+
+                      subject_age+out_of_state+
+                      investigatory+factor(of_gender)*female.prop+
+                      officer_years_of_service+
+                      factor(of_race)+officer_age+
+                      factor(hour_of_day)+factor(month)+factor(year)+
+                      factor(county_name),
+                    data=fl.sm,  
+                    subset=fl.sm$county_include==1&
+                      fl.sm$search_occur==1&
+                      fl.sm$officer_exclude==0)
+save(fl.contra.prop,file="Data/FlContra_Prop_OLS.RData")
+
+# Stop Type
+fl.search.st = lm(search_occur~factor(race_gender)+
+                    subject_age+out_of_state+
+                    factor(of_gender)+factor(of_race)+
+                    officer_years_of_service+officer_age+
+                    factor(hour_of_day)+factor(month)+factor(year)+
+                    factor(county_name),
+                  data=fl.sm,  
+                  subset=fl.sm$county_include==1&fl.sm$officer_exclude==0&
+                    fl.sm$investigatory==1)
+save(fl.search.st,file="Data/FLSearch_StopType_OLS.RData")
+nc.search.st = lm(search~factor(race_gender)+subject_age+
+                    factor(of_gender)+
+                    factor(of_race)+Officer_Years_of_Service+
+                    factor(month)+factor(year)+
+                    factor(CMPD_Division),
+                  data=nc,
+                  subset = nc$investigatory==1)
+save(nc.search.st,file="Data/NCSearch_StopType_OLS.RData")
+fl.contra.st = lm(contra~factor(race_gender)+
+                    subject_age+out_of_state+
+                    factor(of_gender)+
+                    factor(of_race)+
+                    officer_years_of_service+officer_age+
+                    factor(hour_of_day)+factor(month)+factor(year)+
+                    factor(county_name),
+                  data=fl.sm,  
+                  subset=fl.sm$county_include==1&
+                    fl.sm$search_occur==1&
+                    fl.sm$officer_exclude==0&
+                    fl.sm$investigatory==1)
+save(fl.contra.st,file="Data/FlContra_StopType_OLS.RData")
+contra.search.rate.st = lm(contra.search.rate ~ factor(of_gender)+ 
+                             factor(of_exper) + 
+                             factor(of_age) +factor(of_race) +
+                             factor(race_gender) + factor(driver_age)+ 
+                             out_of_state +
+                             factor(year),
+                           data=fl.ag.officers,
+                           subset=fl.ag.officers$search_occur>0&
+                             fl.ag.officers$investigatory==1)
+save(contra.search.rate.st,file="Data/FlSearchRate_StopType_OLS.RData")
+contra.stop.rate.st = lm(contra.stop.rate ~ factor(of_gender)+ 
+                           factor(of_exper) + 
+                           factor(of_age) +factor(of_race) +
+                           factor(race_gender) + factor(driver_age)+ 
+                           out_of_state +
+                           factor(year),
+                         data=fl.ag.officers,
+                         subset=fl.ag.officers$investigatory==1)
+save(contra.stop.rate.st,file="Data/FlStopRate_StopType_OLS.RData")
+
+# Driver Characteristics
+fl.sm$subject_female = ifelse(fl.sm$subject_sex=="female",1,0)
+fl.sm$subject_race2 = ifelse(fl.sm$subject_race=="white",0,
+                             ifelse(fl.sm$subject_race=="black",1,2))
+fl.search.inter = lm(search_occur~factor(of_gender)*factor(subject_female)+
+                       factor(of_race)*factor(subject_race2)+
+                       subject_age+out_of_state+investigatory+
+                       officer_years_of_service+officer_age+
+                       factor(hour_of_day)+factor(month)+factor(year)+
+                       factor(county_name),
+                     data=fl.sm,  
+                     subset=fl.sm$county_include==1&
+                       fl.sm$officer_exclude==0&
+                       as.numeric(fl.sm$of_race)<3)
+save(fl.search.inter,file="Data/FLInter_Search.RData")
+fl.contra.inter = lm(contra~factor(of_gender)*factor(subject_female)+
+                       factor(of_race)*factor(subject_race2)+
+                       subject_age+out_of_state+investigatory+
+                       officer_years_of_service+officer_age+
+                       factor(hour_of_day)+factor(month)+factor(year)+
+                       factor(county_name),
+                     data=fl.sm,  
+                     subset=fl.sm$search_occur==1&
+                       fl.sm$county_include==1&
+                       fl.sm$officer_exclude==0&
+                       as.numeric(fl.sm$of_race)<3)
+save(fl.contra.inter,file="Data/FLInter_Contra.RData")
+fl.ag.officers$subject_female = ifelse(fl.ag.officers$race_gender%in%c(1,3,5),1,0)
+fl.ag.officers$subject_race2 = ifelse(fl.ag.officers$race_gender%in%c(0,1),0,
+                                      ifelse(fl.ag.officers$race_gender%in%c(2,3),1,2))
+contra.search.rate.inter = lm(contra.search.rate ~ factor(of_gender)*factor(subject_female) + 
+                                factor(of_race) * factor(subject_race2)+
+                                factor(of_exper) + factor(of_age) +
+                                factor(race_gender) + factor(driver_age)+ 
+                                investigatory + out_of_state +
+                                factor(year),
+                              data=fl.ag.officers,
+                              subset=fl.ag.officers$search_occur>0)
+save(contra.search.rate.inter,file="Data/FlSearchRate_Inter_OLS.RData")
+contra.stop.rate.inter = lm(contra.stop.rate ~ factor(of_gender)*factor(subject_female) + 
+                              factor(of_race) * factor(subject_race2)+
+                              factor(of_exper) + factor(of_age) +
+                              factor(race_gender) + factor(driver_age)+ 
+                              investigatory + out_of_state +
+                              factor(year),
+                            data=fl.ag.officers)
+save(contra.stop.rate.inter,file="Data/FlStopRate_Inter_OLS.RData")
+
+nc$of_race = ifelse(nc$Officer_Race=="White",0,
+                    ifelse(nc$Officer_Race=="Black/African American",1,
+                           ifelse(nc$Officer_Race=="Hispanic/Latino",2,NA)))
+nc$subject_female = ifelse(nc$Driver_Gender=="Female",1,0)
+nc$subject_race2 = ifelse(nc$Driver_Race=="White"&
+                            nc$Driver_Ethnicity=="Non-Hispanic",0,
+                          ifelse(nc$Driver_Race=="Black"&
+                                   nc$Driver_Ethnicity=="Non-Hispanic",1,
+                                 ifelse(nc$Driver_Ethnicity=="Hispanic",2,NA)))
+nc.search.inter = lm(search~factor(of_gender)*factor(subject_female)+
+                       factor(of_race)*factor(subject_race2)+
+                       subject_age+investigatory+
+                       Officer_Years_of_Service+
+                       factor(month)+factor(year)+
+                       factor(CMPD_Division),
+                     data=nc)
+save(nc.search.inter,file = "Data/NCInter_Search.RData")
+ + + + +
+ + + + + + + + + + + + + + + diff --git a/108/replication_package/OutputFiles/Step3_TablesAndFigures.html b/108/replication_package/OutputFiles/Step3_TablesAndFigures.html new file mode 100644 index 0000000000000000000000000000000000000000..21c603dd9f38c2b467c17e7cc27e8d530d37b70f --- /dev/null +++ b/108/replication_package/OutputFiles/Step3_TablesAndFigures.html @@ -0,0 +1,1627 @@ + + + + + + + + + + + + + + + +Step3_TablesAndFigures.R + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
#######
+#######
+####### Replication files for Do Women Officers Police Differently? Evidence from Traffic Stops
+####### This file produces the tables and figures seen in the paper and appendix.
+####### Last Updated: Jan. 2021
+#######
+#######
+
+###
+### 1. Setting up the space. 
+###
+
+# Setting the working directory:
+setwd("~/Desktop/PinkPolicing/AJPS_ReplicationFiles")
+
+# Installing the needed libraries:
+#install.packages("pscl",dependencies = T)
+#install.packages("ggplot2",dependencies = T)
+#install.packages("texreg",dependencies = T)
+#install.packages("readr",dependencies = T)
+#install.packages("arm",dependencies = T)
+
+# Opening up those libraries:
+library(ggplot2)
+library(texreg)
+
## Version:  1.37.5
+## Date:     2020-06-17
+## Author:   Philip Leifeld (University of Essex)
+## 
+## Consider submitting praise using the praise or praise_interactive functions.
+## Please cite the JSS article in your publications -- see citation("texreg").
+
library(readr)
+library(pscl)
+
## Classes and Methods for R developed in the
+## Political Science Computational Laboratory
+## Department of Political Science
+## Stanford University
+## Simon Jackman
+## hurdle and zeroinfl functions by Achim Zeileis
+
library(arm)
+
## Loading required package: MASS
+
## Loading required package: Matrix
+
## Loading required package: lme4
+
## 
+## arm (Version 1.11-2, built: 2020-7-27)
+
## Working directory is /Users/kelseyshoub/Desktop/PinkPolicing/AJPS_ReplicationFiles
+
###
+### 2. Body of the Paper
+###
+
+# Clearing the workspace + reading in data bit by bit to produce each table and figure. 
+rm(list = ls())
+
+# Loading in the Data
+load("Data/NorthCarolina.RData")
+load("Data/FloridaLarge.RData")
+load("Data/FloridaSmall.RData")
+cmpd.employee = read_csv("Data/CMPD_Employee_Demographics.csv")
+
## 
+## ── Column specification ──────────────────────────────────────────────────────
+## cols(
+##   JOB_TITLE = col_character(),
+##   Years_Of_Service = col_double(),
+##   Age = col_double(),
+##   Gender = col_character(),
+##   Race = col_character(),
+##   ObjectID = col_double()
+## )
+
# Number of stops and searches by sex:
+dim(fl)
+
## [1] 4842950      52
+
dim(nc)
+
## [1] 218158     32
+
table(fl$search_occur)
+
## 
+##       0       1 
+## 4391272   17356
+
table(nc$search)
+
## 
+##      0      1 
+## 207714  10444
+
prop.table(table(fl$search_occur))
+
## 
+##           0           1 
+## 0.996063174 0.003936826
+
prop.table(table(nc$search))
+
## 
+##          0          1 
+## 0.95212644 0.04787356
+
table(fl$of_gender)
+
## 
+##       0       1 
+## 3870641  291604
+
table(nc$of_gender)
+
## 
+##      0      1 
+## 199234  18924
+
table(fl$of_gender,fl$search_occur)
+
##    
+##           0       1
+##   0 3843369   16422
+##   1  290820     272
+
table(nc$of_gender,nc$search)
+
##    
+##          0      1
+##   0 189611   9623
+##   1  18103    821
+
prop.table(table(fl$of_gender,fl$search_occur),1)
+
##    
+##                0            1
+##   0 0.9957453655 0.0042546345
+##   1 0.9990655875 0.0009344125
+
prop.table(table(nc$of_gender,nc$search),1)
+
##    
+##              0          1
+##   0 0.95170001 0.04829999
+##   1 0.95661594 0.04338406
+
table(fl$of_gender,fl$contra)
+
##    
+##           0       1
+##   0 3865730    4911
+##   1  291491     113
+
# Number of officers by sex in FL
+length(unique(fl$officer_id_hash))
+
## [1] 2708
+
length(unique(fl$officer_id_hash[fl$of_gender==0]))
+
## [1] 1916
+
length(unique(fl$officer_id_hash[fl$of_gender==1]))
+
## [1] 244
+
length(unique(fl$officer_id_hash[fl$officer_exclude==0]))
+
## [1] 2338
+
length(unique(fl$officer_id_hash[fl$of_gender==0&fl$officer_exclude==0]))
+
## [1] 1910
+
length(unique(fl$officer_id_hash[fl$of_gender==1&fl$officer_exclude==0]))
+
## [1] 244
+
table(cmpd.employee$JOB_TITLE[cmpd.employee$JOB_TITLE=="Police Officer"])
+
## 
+## Police Officer 
+##           1540
+
sum(table(cmpd.employee$Gender[cmpd.employee$JOB_TITLE=="Police Officer"]))
+
## [1] 1540
+
table(fl$year)
+
## 
+##   2010   2011   2012   2013   2014   2015 
+## 675487 870349 748026 830791 922008 796289
+
(table(fl$of_gender)/c(length(unique(fl$officer_id_hash[fl$of_gender==0&fl$officer_exclude==0])),length(unique(fl$officer_id_hash[fl$of_gender==1&fl$officer_exclude==0]))))/6
+
## 
+##        0        1 
+## 337.7523 199.1831
+
avg.stops = aggregate(fl$year,by=list(fl$officer_id_hash,fl$year,fl$of_gender),length)
+summary(avg.stops)
+
##    Group.1            Group.2             Group.3             x         
+##  Length:9319        Length:9319        Min.   :0.0000   Min.   :   1.0  
+##  Class :character   Class :character   1st Qu.:0.0000   1st Qu.: 125.0  
+##  Mode  :character   Mode  :character   Median :0.0000   Median : 359.0  
+##                                        Mean   :0.1062   Mean   : 446.6  
+##                                        3rd Qu.:0.0000   3rd Qu.: 649.0  
+##                                        Max.   :1.0000   Max.   :5299.0
+
mean(avg.stops$x)
+
## [1] 446.6407
+
median(avg.stops$x[avg.stops$Group.3==0])
+
## [1] 380
+
median(avg.stops$x[avg.stops$Group.3==1])
+
## [1] 202.5
+
prop.table(table(fl$investigatory[fl$of_gender==0]))
+
## 
+##         0         1 
+## 0.4649428 0.5350572
+
prop.table(table(fl$investigatory[fl$of_gender==1]))
+
## 
+##         0         1 
+## 0.4334131 0.5665869
+
table(nc$of_gender[nc$year==2019])[2:1]/table(cmpd.employee$Gender[cmpd.employee$JOB_TITLE=="Police Officer"])
+
## 
+##        1        0 
+## 33.13750 68.11154
+
# Excluding Cases:
+dim(nc)
+
## [1] 218158     32
+
dim(nc)-dim(nc[!is.na(nc$search),])
+
## [1] 0 0
+
dim(fl)
+
## [1] 4842950      52
+
dim(fl)-dim(fl[!is.na(fl$search_occur),])
+
## [1] 434322      0
+
(dim(fl[!is.na(fl$search_occur),])-dim(fl.sm))+table(fl.sm$officer_exclude)[2]
+
## [1] 1695594   18170
+
table(fl.sm$county_include)
+
## 
+##       0       1 
+##     556 2730648
+
# Table 1
+tab1 = data.frame("Department"=c("Charlotte PD (NC)",
+                                 "Male Officers","Female Officers",
+                                 "Florida Highwar Patrol",
+                                 "Male Officers","Female Officers"),
+                  "Type"=c("Municipal","","","Statewide","",""),
+                  "Years"=c("2016-2017","","",
+                            "2010-2015","",""),
+                  "Stops"=c(dim(nc)[1],table(nc$of_gender),
+                            dim(fl[!is.na(fl$search_occur),])[1],
+                            table(fl$of_gender[!is.na(fl$search_occur)])),
+                  "Searches"=c(table(nc$search)[2],table(nc$of_gender,nc$search)[,2],
+                               table(fl$search_occur)[2],
+                               table(fl$of_gender,fl$search_occur)[,2]),
+                  "Search Rate"=c(table(nc$search)[2]/dim(nc)[1],
+                                  table(nc$of_gender,nc$search)[,2]/table(nc$of_gender),
+                                  table(fl$search_occur)[2]/dim(fl[!is.na(fl$search_occur),])[1],
+                                  table(fl$of_gender,fl$search_occur)[,2]/
+                                    table(fl$of_gender[!is.na(fl$search_occur)])))
+tab1 = rbind(tab1,
+             c("Total","","",
+               sum(tab1[c(1,4),4]),sum(tab1[c(1,4),5]),
+               sum(tab1[c(1,4),5])/sum(tab1[c(1,4),4])))
+tab1
+
##               Department      Type     Years   Stops Searches
+## 1      Charlotte PD (NC) Municipal 2016-2017  218158    10444
+## 2          Male Officers                      199234     9623
+## 3        Female Officers                       18924      821
+## 4 Florida Highwar Patrol Statewide 2010-2015 4408628    17356
+## 5          Male Officers                     3859791    16422
+## 6        Female Officers                      291092      272
+## 7                  Total                     4626786    27800
+##            Search.Rate
+## 1   0.0478735595302487
+## 2    0.048299988957708
+## 3   0.0433840625660537
+## 4   0.0039368256972464
+## 5  0.00425463451259408
+## 6 0.000934412488148077
+## 7  0.00600849055910518
+
# Figure 1
+load("Data/Fig1_Data.RData")
+png("Figures/Fig1_PredProb.png",
+    750,519)
+ggplot(data = search.df, aes(x=Department,y=Rate,fill=Gender)) + 
+  geom_bar(stat="identity", position=position_dodge()) + 
+  ylab("Search Rate") +
+  theme_bw(base_size=15)+
+  theme(legend.position = "bottom") +
+  labs(fill="Officer Sex")+
+  scale_fill_grey(start = 0.25, end = .75) 
+dev.off()
+
## quartz_off_screen 
+##                 2
+
prop.test(table(fl$of_gender,fl$search_occur))
+
## 
+##  2-sample test for equality of proportions with continuity correction
+## 
+## data:  table(fl$of_gender, fl$search_occur)
+## X-squared = 744.11, df = 1, p-value < 2.2e-16
+## alternative hypothesis: two.sided
+## 95 percent confidence interval:
+##  -0.003450662 -0.003189782
+## sample estimates:
+##    prop 1    prop 2 
+## 0.9957454 0.9990656
+
prop.test(table(nc$of_gender,nc$search))
+
## 
+##  2-sample test for equality of proportions with continuity correction
+## 
+## data:  table(nc$of_gender, nc$search)
+## X-squared = 9.0552, df = 1, p-value = 0.002619
+## alternative hypothesis: two.sided
+## 95 percent confidence interval:
+##  -0.007996240 -0.001835613
+## sample estimates:
+##    prop 1    prop 2 
+## 0.9517000 0.9566159
+
# Table 2
+load("Data/FLSearch_Sm_OLS.RData")
+load("Data/FLSearch_OLS.RData")
+load("Data/NCSearch_Sm_OLS.RData")
+load("Data/NCSearch_OLS.RData")
+screenreg(list(nc.search,fl.search),
+          stars=c(0.01,0.05),
+          custom.coef.map = list("(Intercept)"="(Intercept)",
+                                 "factor(of_gender)1"="Female Officer",
+                                 "factor(of_race)1"="Black Officer",
+                                 "factor(race_gender)1"="White Female",
+                                 "factor(race_gender)2"="Black Male",
+                                 "factor(race_gender)3"="Black Female",
+                                 "factor(race_gender)4"="Latino Male",
+                                 "factor(race_gender)5"="Latina Female",
+                                 "investigatory" = "Investigatory Stop Purpose"),
+          custom.model.names = c("(1) NC Search",
+                                 "(2) FL Search"),
+          digits=4)
+
## 
+## ===========================================================
+##                             (1) NC Search   (2) FL Search  
+## -----------------------------------------------------------
+## (Intercept)                      0.0862 **        0.0263 **
+##                                 (0.0037)         (0.0005)  
+## Female Officer                  -0.0256 **       -0.0038 **
+##                                 (0.0020)         (0.0002)  
+## Black Officer                   -0.0292 **       -0.0028 **
+##                                 (0.0015)         (0.0001)  
+## White Female                    -0.0086 **       -0.0026 **
+##                                 (0.0019)         (0.0001)  
+## Black Male                       0.0465 **        0.0066 **
+##                                 (0.0016)         (0.0001)  
+## Black Female                    -0.0204 **       -0.0015 **
+##                                 (0.0017)         (0.0002)  
+## Latino Male                                       0.0015 **
+##                                                  (0.0001)  
+## Latina Female                                    -0.0020 **
+##                                                  (0.0002)  
+## Investigatory Stop Purpose       0.0285 **        0.0055 **
+##                                 (0.0012)         (0.0001)  
+## -----------------------------------------------------------
+## R^2                              0.0713           0.0092   
+## Adj. R^2                         0.0711           0.0091   
+## Num. obs.                   150547          2712478        
+## ===========================================================
+## ** p < 0.01; * p < 0.05
+
# Figure 2
+fl.of.pred = predict(fl.search,
+                     newdata = data.frame("of_gender"=c(0,1),"race_gender"=0,
+                                            "subject_age"=35,"out_of_state"=0,
+                                            "investigatory"=1,
+                                          "officer_years_of_service"=6,
+                                          "of_race"=0,"officer_age"=39,
+                                          "hour_of_day"=15,
+                                          "month"="05","year"=2013,
+                                          "county_name"="Orange County"),
+                     type="response",se.fit=T)
+nc.of.pred = predict(nc.search,
+                     newdata = data.frame("of_gender"=c(0,1),
+                                          "race_gender"=0,
+                                          "subject_age"=36,
+                                          "investigatory"=1,
+                                          "Officer_Years_of_Service"=10.25,
+                                          "of_race"=0,"month"="01",
+                                          "year"=2019,"CMPD_Division"="South Division"),
+                     type="response",se.fit=T)
+
+
+
+pred.df = data.frame("Department" = c("Charlotte Police Department",
+                                      "Charlotte Police Department",
+                                      "Florida Highway Patrol",
+                                      "Florida Highway Patrol"),
+                     "Gender" = c("Male","Female","Male","Female"),
+                     "Predict" = c(nc.of.pred$fit,
+                                   fl.of.pred$fit),
+                     "Lower"=c(nc.of.pred$fit-1.96*nc.of.pred$se.fit,
+                               fl.of.pred$fit-1.96*fl.of.pred$se.fit),
+                     "Upper"=c(nc.of.pred$fit+1.96*nc.of.pred$se.fit,
+                               fl.of.pred$fit+1.96*fl.of.pred$se.fit))
+
+png("Figures/Fig2_PredProb.png",
+    900,514)
+ggplot(data = pred.df, aes(x=Gender,y=Predict)) + 
+  geom_point(size=4) +  
+  geom_errorbar(aes(ymin = Lower, ymax = Upper),
+                width=.2,size = 0.75,                   
+                position=position_dodge(.9)) + 
+  ylab("Expected Probbility of a Search") +
+  xlab("Officer Sex") +
+  theme_bw(base_size=15) +facet_wrap(~Department) 
+dev.off()
+
## quartz_off_screen 
+##                 2
+
pred.df$Predict[1]/pred.df$Predict[2]
+
## [1] 2.245964
+
pred.df$Predict[3]/pred.df$Predict[4]
+
## [1] 2.720538
+
# Table 3
+tab3 = data.frame("Officer Gender"=c("Male","Female"),
+                  "Searches"=table(fl$of_gender[!is.na(fl$search_occur)],
+                                   fl$search_occur[!is.na(fl$search_occur)])[,2],
+                  "Contraband"=table(fl$of_gender[!is.na(fl$search_occur)],
+                                     fl$contra[!is.na(fl$search_occur)])[,2],
+                  "Contraband Hit Rate"=table(fl$of_gender[!is.na(fl$search_occur)],
+                                              fl$contra[!is.na(fl$search_occur)])[,2]/
+                    table(fl$of_gender[!is.na(fl$search_occur)],
+                          fl$search_occur[!is.na(fl$search_occur)])[,2],
+                  "Difference"=c((table(fl$of_gender[!is.na(fl$search_occur)],
+                                        fl$contra[!is.na(fl$search_occur)])[,2]/
+                                    table(fl$of_gender[!is.na(fl$search_occur)],
+                                          fl$search_occur[!is.na(fl$search_occur)])[,2])[1]-
+                                   (table(fl$of_gender[!is.na(fl$search_occur)],
+                                          fl$contra[!is.na(fl$search_occur)])[,2]/
+                                      table(fl$of_gender[!is.na(fl$search_occur)],
+                                            fl$search_occur[!is.na(fl$search_occur)])[,2])[2],NA))
+tab3
+
##   Officer.Gender Searches Contraband Contraband.Hit.Rate Difference
+## 0           Male    16422       4911           0.2990501 -0.1163911
+## 1         Female      272        113           0.4154412         NA
+
prop.test(table(fl$of_gender[fl$search_occur==1],
+                fl$contra[fl$search_occur==1]))
+
## 
+##  2-sample test for equality of proportions with continuity correction
+## 
+## data:  table(fl$of_gender[fl$search_occur == 1], fl$contra[fl$search_occur == 1])
+## X-squared = 16.681, df = 1, p-value = 4.423e-05
+## alternative hypothesis: two.sided
+## 95 percent confidence interval:
+##  0.05554105 0.17724120
+## sample estimates:
+##    prop 1    prop 2 
+## 0.7009499 0.5845588
+
# Table 4
+load("Data/FlContra_OLS.RData")
+load("Data/FlSearchRate_OLS.RData")
+load("Data/FlStopRate_OLS.RData")
+screenreg(list(fl.contra,contra.search.rate.reg,contra.stop.rate.reg),
+          stars=c(0.01,0.05),
+          custom.coef.map = list("(Intercept)"="(Intercept)",
+                                 "factor(of_gender)1"="Female Officer",
+                                 "factor(of_race)1"="Black Officer",
+                                 "factor(race_gender)1"="White Female",
+                                 "factor(race_gender)2"="Black Male",
+                                 "factor(race_gender)3"="Black Female",
+                                 "factor(race_gender)4"="Latino Male",
+                                 "factor(race_gender)5"="Latina Female",
+                                 "investigatory" = "Investigatory Stop Purpose"),
+          custom.model.names = c("(1) Contra|Search",
+                                 "(2) Hit Rate, per 10 Searches",
+                                 "(3) Hit Rate, per 100 Stops"),
+          digits=4)
+
## 
+## =========================================================================================================
+##                             (1) Contra|Search  (2) Hit Rate, per 10 Searches  (3) Hit Rate, per 100 Stops
+## ---------------------------------------------------------------------------------------------------------
+## (Intercept)                     0.1118 **         0.3006                           0.1380 **             
+##                                (0.0421)          (0.2148)                         (0.0176)               
+## Female Officer                  0.1026 **         1.1223 **                       -0.0771 **             
+##                                (0.0294)          (0.2760)                         (0.0117)               
+## Black Officer                   0.0578 **         0.7640 **                       -0.0976 **             
+##                                (0.0199)          (0.2030)                         (0.0096)               
+## White Female                   -0.0025            0.0512                          -0.0557 **             
+##                                (0.0144)          (0.1467)                         (0.0096)               
+## Black Male                     -0.0531 **        -0.4505 **                        0.0975 **             
+##                                (0.0097)          (0.1058)                         (0.0104)               
+## Black Female                   -0.0594 **        -0.4565 **                       -0.0519 **             
+##                                (0.0172)          (0.1728)                         (0.0117)               
+## Latino Male                    -0.0909 **        -0.8755 **                       -0.0021                
+##                                (0.0115)          (0.1195)                         (0.0107)               
+## Latina Female                  -0.0027            0.0346                          -0.0669 **             
+##                                (0.0267)          (0.2586)                         (0.0128)               
+## Investigatory Stop Purpose      0.3394 **         3.4794 **                        0.2534 **             
+##                                (0.0112)          (0.1102)                         (0.0066)               
+## ---------------------------------------------------------------------------------------------------------
+## R^2                             0.1346            0.1311                           0.0036                
+## Adj. R^2                        0.1265            0.1285                           0.0036                
+## Num. obs.                   12782              9677                           747784                     
+## =========================================================================================================
+## ** p < 0.01; * p < 0.05
+
###
+### 3. Appendix A: Full Regression Results
+###
+
+screenreg(list(nc.search,fl.search,
+               fl.contra,contra.search.rate.reg,contra.stop.rate.reg),
+          stars=c(0.01,0.05),
+          custom.coef.map = list("(Intercept)"="(Intercept)",
+                                 "factor(of_gender)1"="Female Officer",
+                                 "factor(of_race)1"="Black Officer",
+                                 "officer_age"="Officer Age",
+                                 "factor(of_age)2"="Officer Age: 30-64",
+                                 "factor(of_age)3"="Officer Age: 65+",
+                                 "officer_years_of_service"="Officer Years of Service",
+                                 "Officer_Years_of_Service"="Officer Years of Service",
+                                 "factor(of_exper)1"="Experienced Officer",
+                                 "factor(race_gender)1"="White Female",
+                                 "factor(race_gender)2"="Black Male",
+                                 "factor(race_gender)3"="Black Female",
+                                 "factor(race_gender)4"="Latino Male",
+                                 "factor(race_gender)5"="Latina Female",
+                                 "subject_age"="Driver Age",
+                                 "factor(driver_age)2"="Driver Age: 30-64",
+                                 "factor(driver_age)3"="Driver Age: 65+",
+                                 "investigatory" = "Investigatory Stop Purpose",
+                                 "out_of_state"="Out of State"),
+          custom.model.names = c("(1)","(2)",
+                                 "(3)","(4)","(5)"),
+          digits=3)
+
## 
+## ===================================================================================================
+##                             (1)            (2)             (3)           (4)          (5)          
+## ---------------------------------------------------------------------------------------------------
+## (Intercept)                      0.086 **        0.026 **      0.112 **     0.301          0.138 **
+##                                 (0.004)         (0.001)       (0.042)      (0.215)        (0.018)  
+## Female Officer                  -0.026 **       -0.004 **      0.103 **     1.122 **      -0.077 **
+##                                 (0.002)         (0.000)       (0.029)      (0.276)        (0.012)  
+## Black Officer                   -0.029 **       -0.003 **      0.058 **     0.764 **      -0.098 **
+##                                 (0.001)         (0.000)       (0.020)      (0.203)        (0.010)  
+## Officer Age                                     -0.000 **     -0.004 **                            
+##                                                 (0.000)       (0.001)                              
+## Officer Age: 30-64                                                         -0.375 **      -0.044 **
+##                                                                            (0.096)        (0.008)  
+## Officer Age: 65+                                                           -0.829         -0.262   
+##                                                                            (4.048)        (0.183)  
+## Officer Years of Service        -0.002 **        0.000 **     -0.000                               
+##                                 (0.000)         (0.000)       (0.001)                              
+## Experienced Officer                                                        -0.026          0.053 **
+##                                                                            (0.086)        (0.007)  
+## White Female                    -0.009 **       -0.003 **     -0.003        0.051         -0.056 **
+##                                 (0.002)         (0.000)       (0.014)      (0.147)        (0.010)  
+## Black Male                       0.046 **        0.007 **     -0.053 **    -0.451 **       0.098 **
+##                                 (0.002)         (0.000)       (0.010)      (0.106)        (0.010)  
+## Black Female                    -0.020 **       -0.001 **     -0.059 **    -0.456 **      -0.052 **
+##                                 (0.002)         (0.000)       (0.017)      (0.173)        (0.012)  
+## Latino Male                                      0.001 **     -0.091 **    -0.876 **      -0.002   
+##                                                 (0.000)       (0.011)      (0.120)        (0.011)  
+## Latina Female                                   -0.002 **     -0.003        0.035         -0.067 **
+##                                                 (0.000)       (0.027)      (0.259)        (0.013)  
+## Driver Age                      -0.001 **       -0.000 **     -0.003 **                            
+##                                 (0.000)         (0.000)       (0.000)                              
+## Driver Age: 30-64                                                          -0.485 **      -0.123 **
+##                                                                            (0.085)        (0.007)  
+## Driver Age: 65+                                                            -1.113 *       -0.187 **
+##                                                                            (0.446)        (0.012)  
+## Investigatory Stop Purpose       0.028 **        0.006 **      0.339 **     3.479 **       0.253 **
+##                                 (0.001)         (0.000)       (0.011)      (0.110)        (0.007)  
+## Out of State                                     0.001 **     -0.053 **    -0.667 **       0.037 **
+##                                                 (0.000)       (0.011)      (0.110)        (0.008)  
+## ---------------------------------------------------------------------------------------------------
+## R^2                              0.071           0.009         0.135        0.131          0.004   
+## Adj. R^2                         0.071           0.009         0.127        0.128          0.004   
+## Num. obs.                   150547         2712478         12782         9677         747784       
+## ===================================================================================================
+## ** p < 0.01; * p < 0.05
+
###
+### 4. Appendix B: Alternative Test of Differences in Search and Contraband Hit Rates
+###
+
+# Florida
+fl$stop = 1
+fl$of_exper = ifelse(fl$officer_years_of_service>=
+                       mean(fl$officer_years_of_service,na.rm=T),1,0)
+fl$of_age = ifelse(fl$officer_age<30,1,
+                   ifelse(fl$officer_age>64,3,2))
+fl$driver_age = ifelse(fl$subject_age<30,1,
+                       ifelse(fl$subject_age>64,3,2))
+fl$hour_of_day=as.numeric(fl$hour_of_day)
+fl$tod = ifelse(fl$hour_of_day<3,1,
+                ifelse(fl$hour_of_day<6,2,
+                       ifelse(fl$hour_of_day<9,3,
+                              ifelse(fl$hour_of_day<12,4,
+                                     ifelse(fl$hour_of_day<15,5,
+                                            ifelse(fl$hour_of_day<18,6,
+                                                   ifelse(fl$hour_of_day<21,7,8)))))))
+
+fl.ag = aggregate(fl[!is.na(fl$search_occur),c("stop","search_occur","contra")], 
+                  by = list(fl$tod[!is.na(fl$search_occur)],
+                            fl$officer_race[!is.na(fl$search_occur)],
+                            fl$officer_sex[!is.na(fl$search_occur)],
+                            fl$of_exper[!is.na(fl$search_occur)],
+                            fl$race_gender[!is.na(fl$search_occur)],
+                            fl$driver_age[!is.na(fl$search_occur)],
+                            fl$out_of_state[!is.na(fl$search_occur)],
+                            fl$investigatory[!is.na(fl$search_occur)]),
+                  sum,na.rm=T)
+colnames(fl.ag) = c("tod",
+                    "of_race","of_sex","of_exper","driver_rg",
+                    "driver_age","out_of_state","invest",
+                    "stop","search","contraband")
+fl.ag.female = fl.ag[fl.ag$of_sex=="female",]
+colnames(fl.ag.female)[c(3,9:11)] = c("female","stop.f",
+                                       "search.f","contra.f")
+fl.ag.male = fl.ag[fl.ag$of_sex=="male",]
+colnames(fl.ag.male)[c(3,9:11)] = c("male","stop.m",
+                                     "search.m","contra.m")
+
+fl.matches = merge(fl.ag.female,fl.ag.male)
+min.stops = 9
+table(fl.matches$stop.f>min.stops&
+        fl.matches$stop.m>min.stops)
+
## 
+## FALSE  TRUE 
+##  1461  1784
+
min.searches = 0
+table(fl.matches$search.f>min.searches&
+        fl.matches$search.m>min.searches)
+
## 
+## FALSE  TRUE 
+##  3084   161
+
table(fl.matches$search.f>min.searches&
+        fl.matches$search.m>min.searches&
+        fl.matches$stop.f>min.stops&
+        fl.matches$stop.m>min.stops)
+
## 
+## FALSE  TRUE 
+##  3084   161
+
# North Carolina
+nc$stop = 1
+nc$search = ifelse(nc$Was_a_Search_Conducted=="Yes",1,0)
+nc$driver_age = ifelse(nc$Driver_Age<30,1,
+                       ifelse(nc$Driver_Age>65,3,2))
+nc$of_exper = ifelse(nc$Officer_Years_of_Service>=mean(nc$Officer_Years_of_Service),
+                     1,0)
+nc.ag = aggregate(nc[,c("search","stop")], 
+                  by = list(nc$CMPD_Division,
+                            nc$Officer_Gender,nc$Officer_Race,
+                            nc$of_exper,
+                            nc$race_gender,nc$driver_age,
+                            nc$investigatory,
+                            nc$year),
+                  sum)
+nc.ag.female = nc.ag[nc.ag$Group.2=="Female",]
+colnames(nc.ag.female) = c("division","female","race","of_exper",
+                           "driver.rg","driver_age","investigatory",
+                           "year",
+                           "searches.f","stops.f")
+nc.ag.male = nc.ag[nc.ag$Group.2=="Male",]
+colnames(nc.ag.male) = c("division","male","race","of_exper",
+                         "driver.rg","driver_age","investigatory",
+                         "year",
+                         "searches.m","stops.m")
+
+
+# Searches
+fl.matches$sr.f = fl.matches$search.f/fl.matches$stop.f
+fl.matches$sr.m = fl.matches$search.m/fl.matches$stop.m
+fl.matches$cr.f = fl.matches$contra.f/fl.matches$search.f
+fl.matches$cr.m = fl.matches$contra.m/fl.matches$search.m
+t.test(fl.matches$sr.f[fl.matches$stop.f>min.stops&
+                         fl.matches$stop.m>min.stops],
+       fl.matches$sr.m[fl.matches$stop.f>min.stops&
+                         fl.matches$stop.m>min.stops],
+       paired = T)
+
## 
+##  Paired t-test
+## 
+## data:  fl.matches$sr.f[fl.matches$stop.f > min.stops & fl.matches$stop.m > min.stops] and fl.matches$sr.m[fl.matches$stop.f > min.stops & fl.matches$stop.m > min.stops]
+## t = -13.359, df = 1783, p-value < 2.2e-16
+## alternative hypothesis: true difference in means is not equal to 0
+## 95 percent confidence interval:
+##  -0.003700686 -0.002753143
+## sample estimates:
+## mean of the differences 
+##            -0.003226915
+
length(fl.matches$sr.f[fl.matches$stop.f>min.stops&
+                         fl.matches$stop.m>min.stops])
+
## [1] 1784
+
mean(fl.matches$sr.f[fl.matches$stop.f>min.stops&
+                       fl.matches$stop.m>min.stops])
+
## [1] 0.001355022
+
mean(fl.matches$sr.m[fl.matches$stop.f>min.stops&
+                       fl.matches$stop.m>min.stops])
+
## [1] 0.004581936
+
nc.matches = merge(nc.ag.female,nc.ag.male)
+min.stops = 9
+nc.matches$sr.f = nc.matches$searches.f/nc.matches$stops.f
+nc.matches$sr.m = nc.matches$searches.m/nc.matches$stops.m
+t.test(nc.matches$sr.f[nc.matches$stops.f>min.stops&
+                         nc.matches$stops.m>min.stops],
+       nc.matches$sr.m[nc.matches$stops.f>min.stops&
+                         nc.matches$stops.m>min.stops],
+       paired = T)
+
## 
+##  Paired t-test
+## 
+## data:  nc.matches$sr.f[nc.matches$stops.f > min.stops & nc.matches$stops.m > min.stops] and nc.matches$sr.m[nc.matches$stops.f > min.stops & nc.matches$stops.m > min.stops]
+## t = -4.0127, df = 352, p-value = 7.335e-05
+## alternative hypothesis: true difference in means is not equal to 0
+## 95 percent confidence interval:
+##  -0.024123468 -0.008254384
+## sample estimates:
+## mean of the differences 
+##             -0.01618893
+
length(nc.matches$sr.f[nc.matches$stops.f>min.stops&
+                         nc.matches$stops.m>min.stops])
+
## [1] 353
+
mean(nc.matches$sr.f[nc.matches$stops.f>min.stops&
+                       nc.matches$stops.m>min.stops])
+
## [1] 0.05538775
+
mean(nc.matches$sr.m[nc.matches$stops.f>min.stops&
+                       nc.matches$stops.m>min.stops],)
+
## [1] 0.07157667
+
# Contraband
+t.test(fl.matches$cr.f[fl.matches$search.f>min.searches&
+                         fl.matches$search.m>min.searches&
+                         fl.matches$stop.f>min.stops&
+                         fl.matches$stop.m>min.stops],
+       fl.matches$cr.m[fl.matches$search.f>min.searches&
+                         fl.matches$search.m>min.searches&
+                         fl.matches$stop.f>min.stops&
+                         fl.matches$stop.m>min.stops],
+       paired = T)
+
## 
+##  Paired t-test
+## 
+## data:  fl.matches$cr.f[fl.matches$search.f > min.searches & fl.matches$search.m > min.searches & fl.matches$stop.f > min.stops & fl.matches$stop.m > min.stops] and fl.matches$cr.m[fl.matches$search.f > min.searches & fl.matches$search.m > min.searches & fl.matches$stop.f > min.stops & fl.matches$stop.m > min.stops]
+## t = 2.6679, df = 160, p-value = 0.008419
+## alternative hypothesis: true difference in means is not equal to 0
+## 95 percent confidence interval:
+##  0.02401357 0.16088431
+## sample estimates:
+## mean of the differences 
+##              0.09244894
+
length(fl.matches$cr.f[fl.matches$search.f>min.searches&
+                         fl.matches$search.m>min.searches&
+                         fl.matches$stop.f>min.stops&
+                         fl.matches$stop.m>min.stops])
+
## [1] 161
+
mean(fl.matches$cr.f[fl.matches$search.f>min.searches&
+                       fl.matches$search.m>min.searches&
+                       fl.matches$stop.f>min.stops&
+                       fl.matches$stop.m>min.stops])
+
## [1] 0.4090506
+
mean(fl.matches$cr.m[fl.matches$search.f>min.searches&
+                       fl.matches$search.m>min.searches&
+                       fl.matches$stop.f>min.stops&
+                       fl.matches$stop.m>min.stops])
+
## [1] 0.3166016
+
###
+### 5. Appendix C: Logistic Regrssion Models
+###
+
+rm(list = ls())
+
+load("Data/FlContra_Logit.RData")
+load("Data/FLSearch_Logit.RData")
+load("Data/NCSearch_Logit.RData")
+
+texreg(list(nc.search,fl.search,fl.contra),
+          stars=c(0.01,0.05),
+          custom.coef.map = list("(Intercept)"="(Intercept)",
+                                 "factor(of_gender)1"="Female Officer",
+                                 "factor(of_race)1"="Black Officer",
+                                 "factor(of_race)2"="Latinx Officer",
+                                 "factor(of_race)3"="Asain/Pacific Islander Officer",
+                                 "factor(of_race)4"="Other Race Officer",
+                                 "officer_age"="Officer Age",
+                                 "officer_years_of_service"="Officer Years of Service",
+                                 "Officer_Years_of_Service"="Officer Years of Service",
+                                 "factor(race_gender)1"="White Female",
+                                 "factor(race_gender)2"="Black Male",
+                                 "factor(race_gender)3"="Black Female",
+                                 "factor(race_gender)4"="Latino Male",
+                                 "factor(race_gender)5"="Latina Female",
+                                 "subject_age"="Driver Age",
+                                 "investigatory" = "Investigatory Stop Purpose",
+                                 "out_of_state"="Out of State"),
+          custom.model.names = c("(1) NC Search",
+                                 "(2) FL Search",
+                                 "(3) FL Contra|Search"),
+          digits=4)
+
## 
+## \begin{table}
+## \begin{center}
+## \begin{tabular}{l c c c}
+## \hline
+##  & (1) NC Search & (2) FL Search & (3) FL Contra|Search \\
+## \hline
+## (Intercept)                    & $-1.9244^{**}$ & $-2.8175^{**}$ & $-17.9811$     \\
+##                                & $(0.0906)$     & $(0.0900)$     & $(148.7052)$   \\
+## Female Officer                 & $-0.4702^{**}$ & $-1.4253^{**}$ & $0.4986^{**}$  \\
+##                                & $(0.0477)$     & $(0.0674)$     & $(0.1547)$     \\
+## Black Officer                  & $-0.7213^{**}$ & $-1.0929^{**}$ & $0.2932^{**}$  \\
+##                                & $(0.0387)$     & $(0.0441)$     & $(0.1060)$     \\
+## Latinx Officer                 &                & $-0.3512^{**}$ & $-0.1044$      \\
+##                                &                & $(0.0363)$     & $(0.0924)$     \\
+## Asain/Pacific Islander Officer &                & $-1.0206^{**}$ & $0.7392$       \\
+##                                &                & $(0.2019)$     & $(0.5612)$     \\
+## Other Race Officer             &                & $-0.8249^{**}$ & $0.8317^{*}$   \\
+##                                &                & $(0.1632)$     & $(0.3917)$     \\
+## Officer Age                    &                & $-0.0221^{**}$ & $-0.0202^{**}$ \\
+##                                &                & $(0.0012)$     & $(0.0036)$     \\
+## Officer Years of Service       & $-0.0770^{**}$ & $0.0129^{**}$  & $-0.0002$      \\
+##                                & $(0.0023)$     & $(0.0017)$     & $(0.0045)$     \\
+## White Female                   & $-0.6166^{**}$ & $-0.8276^{**}$ & $-0.0151$      \\
+##                                & $(0.0751)$     & $(0.0337)$     & $(0.0782)$     \\
+## Black Male                     & $0.8877^{**}$  & $0.8883^{**}$  & $-0.2900^{**}$ \\
+##                                & $(0.0436)$     & $(0.0228)$     & $(0.0534)$     \\
+## Black Female                   & $-0.4638^{**}$ & $-0.2870^{**}$ & $-0.3230^{**}$ \\
+##                                & $(0.0518)$     & $(0.0404)$     & $(0.0960)$     \\
+## Latino Male                    &                & $0.3641^{**}$  & $-0.5462^{**}$ \\
+##                                &                & $(0.0276)$     & $(0.0663)$     \\
+## Latina Female                  &                & $-0.7432^{**}$ & $0.0039$       \\
+##                                &                & $(0.0624)$     & $(0.1465)$     \\
+## Driver Age                     & $-0.0422^{**}$ & $-0.0450^{**}$ & $-0.0161^{**}$ \\
+##                                & $(0.0012)$     & $(0.0008)$     & $(0.0022)$     \\
+## Investigatory Stop Purpose     & $0.6995^{**}$  & $1.5916^{**}$  & $17.9495$      \\
+##                                & $(0.0298)$     & $(0.0262)$     & $(148.7051)$   \\
+## Out of State                   &                & $0.3653^{**}$  & $-0.3378^{**}$ \\
+##                                &                & $(0.0269)$     & $(0.0667)$     \\
+## \hline
+## AIC                            & $49914.2052$   & $137958.1571$  & $13507.4833$   \\
+## BIC                            & $50261.4763$   & $139508.5753$  & $14402.1785$   \\
+## Log Likelihood                 & $-24922.1026$  & $-68858.0786$  & $-6633.7416$   \\
+## Deviance                       & $49844.2052$   & $137716.1571$  & $13267.4833$   \\
+## Num. obs.                      & $150547$       & $2712478$      & $12782$        \\
+## \hline
+## \multicolumn{4}{l}{\scriptsize{$^{**}p<0.01$; $^{*}p<0.05$}}
+## \end{tabular}
+## \caption{Statistical models}
+## \label{table:coefficients}
+## \end{center}
+## \end{table}
+
###
+### 6. Appendix C: Fixed Effects 
+###
+
+rm(list = ls())
+
+load("Data/FLSearch_OLS_FE.RData")
+load("Data/FlContra_OLS_FE.RData")
+load("Data/FlSearchRate_OLS_FE.RData")
+load("Data/FlStopRate_OLS_FE.RData")
+
+texreg(list(fl.search,
+               fl.contra,
+               contra.search.rate.reg,
+               contra.stop.rate.reg),
+          stars=c(0.01,0.05),
+          custom.coef.map = list("(Intercept)"="(Intercept)",
+                                 "factor(of_gender)1"="Female Officer",
+                                 "factor(of_race)1"="Black Officer",
+                                 "officer_age"="Officer Age",
+                                 "factor(of_age)2"="Officer Age: 30-64",
+                                 "factor(of_age)3"="Officer Age: 65+",
+                                 "officer_years_of_service"="Officer Years of Service",
+                                 "Officer_Years_of_Service"="Officer Years of Service",
+                                 "factor(of_exper)1"="Experienced Officer",
+                                 "factor(race_gender)1"="White Female",
+                                 "factor(race_gender)2"="Black Male",
+                                 "factor(race_gender)3"="Black Female",
+                                 "factor(race_gender)4"="Latino Male",
+                                 "factor(race_gender)5"="Latina Female",
+                                 "subject_age"="Driver Age",
+                                 "factor(driver_age)2"="Driver Age: 30-64",
+                                 "factor(driver_age)3"="Driver Age: 65+",
+                                 "investigatory" = "Investigatory Stop Purpose",
+                                 "out_of_state"="Out of State"),
+          custom.model.names = c("(1) Search",
+                                 "(2) Contra|Search",
+                                 "(3) Hit Rate, per 10 Searches",
+                                 "(4) Hit Rate, per 100 Stops"),
+          digits=4)
+
## 
+## \begin{table}
+## \begin{center}
+## \begin{tabular}{l c c c c}
+## \hline
+##  & (1) Search & (2) Contra|Search & (3) Hit Rate, per 10 Searches & (4) Hit Rate, per 100 Stops \\
+## \hline
+## (Intercept)                        & $0.0142^{**}$   & $0.1363^{*}$   & $0.2596$       & $0.0707^{**}$   \\
+##                                    & $(0.0017)$      & $(0.0567)$     & $(0.2384)$     & $(0.0232)$      \\
+## Female Officer                     & $-0.0026^{*}$   & $0.0916^{*}$   & $0.9424^{*}$   & $-0.0531$       \\
+##                                    & $(0.0013)$      & $(0.0376)$     & $(0.3793)$     & $(0.0334)$      \\
+## Black Officer                      & $-0.0035^{**}$  & $0.0541$       & $0.3139$       & $-0.0894^{**}$  \\
+##                                    & $(0.0012)$      & $(0.0399)$     & $(0.4081)$     & $(0.0306)$      \\
+## Officer Age                        & $-0.0001^{**}$  & $-0.0048^{**}$ &                &                 \\
+##                                    & $(0.0000)$      & $(0.0012)$     &                &                 \\
+## Officer Age: 30-64                 &                 &                & $-0.4058^{**}$ & $-0.0231$       \\
+##                                    &                 &                & $(0.1474)$     & $(0.0160)$      \\
+## Officer Age: 65+                   &                 &                & $-0.5371$      & $-0.1241$       \\
+##                                    &                 &                & $(4.0924)$     & $(0.2141)$      \\
+## Officer Years of Service           & $0.0002^{**}$   & $0.0024$       &                &                 \\
+##                                    & $(0.0000)$      & $(0.0016)$     &                &                 \\
+## Experienced Officer                &                 &                & $0.3207^{*}$   & $0.0692^{**}$   \\
+##                                    &                 &                & $(0.1614)$     & $(0.0151)$      \\
+## White Female                       & $-0.0022^{**}$  & $-0.0037$      & $0.0647$       & $-0.0545^{**}$  \\
+##                                    & $(0.0001)$      & $(0.0142)$     & $(0.1418)$     & $(0.0096)$      \\
+## Black Male                         & $0.0051^{**}$   & $-0.0535^{**}$ & $-0.5417^{**}$ & $0.0851^{**}$   \\
+##                                    & $(0.0001)$      & $(0.0097)$     & $(0.1042)$     & $(0.0104)$      \\
+## Black Female                       & $-0.0019^{**}$  & $-0.0609^{**}$ & $-0.4922^{**}$ & $-0.0630^{**}$  \\
+##                                    & $(0.0002)$      & $(0.0170)$     & $(0.1682)$     & $(0.0116)$      \\
+## Latino Male                        & $0.0013^{**}$   & $-0.0909^{**}$ & $-0.8668^{**}$ & $-0.0088$       \\
+##                                    & $(0.0001)$      & $(0.0114)$     & $(0.1177)$     & $(0.0107)$      \\
+## Latina Female                      & $-0.0019^{**}$  & $-0.0114$      & $-0.1267$      & $-0.0675^{**}$  \\
+##                                    & $(0.0002)$      & $(0.0264)$     & $(0.2512)$     & $(0.0128)$      \\
+## Driver Age                         & $-0.0001^{**}$  & $-0.0023^{**}$ &                &                 \\
+##                                    & $(0.0000)$      & $(0.0004)$     &                &                 \\
+## Driver Age: 30-64                  &                 &                & $-0.3525^{**}$ & $-0.1190^{**}$  \\
+##                                    &                 &                & $(0.0829)$     & $(0.0069)$      \\
+## Driver Age: 65+                    &                 &                & $-0.8633^{*}$  & $-0.1688^{**}$  \\
+##                                    &                 &                & $(0.4308)$     & $(0.0117)$      \\
+## Investigatory Stop Purpose         & $0.0041^{**}$   & $0.3340^{**}$  & $3.3725^{**}$  & $0.2428^{**}$   \\
+##                                    & $(0.0001)$      & $(0.0112)$     & $(0.1081)$     & $(0.0067)$      \\
+## Out of State                       & $0.0018^{**}$   & $-0.0544^{**}$ & $-0.5205^{**}$ & $0.0317^{**}$   \\
+##                                    & $(0.0001)$      & $(0.0112)$     & $(0.1093)$     & $(0.0083)$      \\
+## \hline
+## AIC                                & $-6993843.0503$ & $15022.3545$   & $54081.7043$   & $3674955.2660$  \\
+## BIC                                & $-6992267.0054$ & $15931.9613$   & $54311.3845$   & $3675324.0618$  \\
+## Log Likelihood                     & $3497044.5251$  & $-7389.1773$   & $-27008.8521$  & $-1837445.6330$ \\
+## Num. obs.                          & $2712478$       & $12782$        & $9677$         & $747784$        \\
+## Num. groups: officer\_id\_hash     & $1419$          & $599$          & $$             & $$              \\
+## Var: officer\_id\_hash (Intercept) & $0.0002$        & $0.0150$       & $$             & $$              \\
+## Var: Residual                      & $0.0044$        & $0.1744$       & $14.8268$      & $7.9441$        \\
+## Num. groups: officer\_id           & $$              & $$             & $602$          & $1424$          \\
+## Var: officer\_id (Intercept)       & $$              & $$             & $2.1381$       & $0.1270$        \\
+## \hline
+## \multicolumn{5}{l}{\scriptsize{$^{**}p<0.01$; $^{*}p<0.05$}}
+## \end{tabular}
+## \caption{Statistical models}
+## \label{table:coefficients}
+## \end{center}
+## \end{table}
+
###
+### 7. Appendix D: Interaction Models
+###
+
+rm(list = ls())
+
+# Table 1. Officer Experience
+load("Data/FLSearch_Exper_OLS.RData")
+load("Data/NCSearch_Exper_OLS.RData")
+load("Data/FlContra_Exper_OLS.RData")
+load("Data/FlSearchRate_Exper_OLS.RData")
+load("Data/FlStopRate_Exper_OLS.RData")
+
+texreg(list(nc.search.exper,fl.search.exper,fl.contra.exper,
+            contra.search.rate.exper,contra.stop.rate.exper),
+       stars=c(0.05,0.01),
+       custom.coef.map = list("factor(of_gender)1"="Female Officer",
+                              "officer_years_of_service"="Officer Years of Service",
+                              "Officer_Years_of_Service"="Officer Years of Service",
+                              "factor(of_exper)1"="Experienced Officer",
+                              "factor(of_gender)1:officer_years_of_service"="Female Officer * Exper.",
+                              "factor(of_gender)1:Officer_Years_of_Service"="Female Officer * Exper.",
+                              "factor(of_gender)1:factor(of_exper)1"="Female Officer * Exper."),
+       digits = 3)
+
## 
+## \begin{table}
+## \begin{center}
+## \begin{tabular}{l c c c c c}
+## \hline
+##  & Model 1 & Model 2 & Model 3 & Model 4 & Model 5 \\
+## \hline
+## Female Officer           & $-0.025^{**}$ & $-0.004^{**}$ & $0.112^{**}$ & $0.971^{**}$ & $-0.059^{**}$ \\
+##                          & $(0.003)$     & $(0.000)$     & $(0.040)$    & $(0.364)$    & $(0.015)$     \\
+## Officer Years of Service & $-0.002^{**}$ & $0.000^{**}$  & $-0.000$     &              &               \\
+##                          & $(0.000)$     & $(0.000)$     & $(0.001)$    &              &               \\
+## Experienced Officer      &               &               &              & $-0.043$     & $0.056^{**}$  \\
+##                          &               &               &              & $(0.087)$    & $(0.008)$     \\
+## Female Officer * Exper.  & $-0.000$      & $-0.000$      & $-0.002$     & $0.443$      & $-0.047^{*}$  \\
+##                          & $(0.000)$     & $(0.000)$     & $(0.005)$    & $(0.558)$    & $(0.024)$     \\
+## \hline
+## R$^2$                    & $0.071$       & $0.009$       & $0.135$      & $0.129$      & $0.003$       \\
+## Adj. R$^2$               & $0.071$       & $0.009$       & $0.126$      & $0.127$      & $0.003$       \\
+## Num. obs.                & $150547$      & $2712478$     & $12782$      & $9677$       & $747784$      \\
+## \hline
+## \multicolumn{6}{l}{\scriptsize{$^{**}p<0.01$; $^{*}p<0.05$}}
+## \end{tabular}
+## \caption{Statistical models}
+## \label{table:coefficients}
+## \end{center}
+## \end{table}
+
# Table 2. Prop Female
+load("Data/FLSearch_Prop_OLS.RData")
+load("Data/FlContra_Prop_OLS.RData")
+
+texreg(list(fl.search.prop,fl.contra.prop),
+       stars=c(0.05,0.01),
+       custom.coef.map = list("factor(of_gender)1"="Female Officer",
+                              "female.prop"="Female Proportion of Proximate Force",
+                              "factor(of_gender)1:female.prop"="Female Officer * Female Prop."),
+       digits = 3)
+
## 
+## \begin{table}
+## \begin{center}
+## \begin{tabular}{l c c}
+## \hline
+##  & Model 1 & Model 2 \\
+## \hline
+## Female Officer                       & $-0.003^{**}$ & $0.434^{**}$  \\
+##                                      & $(0.001)$     & $(0.105)$     \\
+## Female Proportion of Proximate Force & $-0.004$      & $-0.269$      \\
+##                                      & $(0.002)$     & $(0.203)$     \\
+## Female Officer * Female Prop.        & $-0.010$      & $-3.350^{**}$ \\
+##                                      & $(0.006)$     & $(1.020)$     \\
+## \hline
+## R$^2$                                & $0.009$       & $0.136$       \\
+## Adj. R$^2$                           & $0.009$       & $0.127$       \\
+## Num. obs.                            & $2712478$     & $12782$       \\
+## \hline
+## \multicolumn{3}{l}{\scriptsize{$^{**}p<0.01$; $^{*}p<0.05$}}
+## \end{tabular}
+## \caption{Statistical models}
+## \label{table:coefficients}
+## \end{center}
+## \end{table}
+
# Table 3. Stop Type
+load("Data/FLSearch_StopType_OLS.RData")
+load("Data/NCSearch_StopType_OLS.RData")
+load("Data/FlContra_StopType_OLS.RData")
+load("Data/FlSearchRate_StopType_OLS.RData")
+load("Data/FlStopRate_StopType_OLS.RData")
+
+texreg(list(nc.search.st,fl.search.st,fl.contra.st,
+            contra.search.rate.st,contra.stop.rate.st),
+       stars=c(0.05,0.01),
+       custom.coef.map = list("(Intercept)"="(Intercept)",
+                              "factor(of_gender)1"="Female Officer",
+                              "factor(of_race)1"="Black Officer",
+                              "officer_age"="Officer Age",
+                              "factor(of_age)2"="Officer Age: 30-64",
+                              "factor(of_age)3"="Officer Age: 65+",
+                              "officer_years_of_service"="Officer Years of Service",
+                              "Officer_Years_of_Service"="Officer Years of Service",
+                              "factor(of_exper)1"="Experienced Officer",
+                              "factor(race_gender)1"="White Female",
+                              "factor(race_gender)2"="Black Male",
+                              "factor(race_gender)3"="Black Female",
+                              "factor(race_gender)4"="Latino Male",
+                              "factor(race_gender)5"="Latina Female",
+                              "subject_age"="Driver Age",
+                              "factor(driver_age)2"="Driver Age: 30-64",
+                              "factor(driver_age)3"="Driver Age: 65+",
+                              "investigatory" = "Investigatory Stop Purpose",
+                              "out_of_state"="Out of State"),
+       digits = 3)
+
## 
+## \begin{table}
+## \begin{center}
+## \begin{tabular}{l c c c c c}
+## \hline
+##  & Model 1 & Model 2 & Model 3 & Model 4 & Model 5 \\
+## \hline
+## (Intercept)              & $0.145^{**}$  & $0.045^{**}$  & $0.485^{**}$  & $3.754^{**}$  & $0.449^{**}$  \\
+##                          & $(0.006)$     & $(0.001)$     & $(0.048)$     & $(0.170)$     & $(0.025)$     \\
+## Female Officer           & $-0.032^{**}$ & $-0.006^{**}$ & $0.114^{**}$  & $1.322^{**}$  & $-0.147^{**}$ \\
+##                          & $(0.003)$     & $(0.000)$     & $(0.034)$     & $(0.323)$     & $(0.022)$     \\
+## Black Officer            & $-0.039^{**}$ & $-0.005^{**}$ & $0.065^{**}$  & $0.892^{**}$  & $-0.195^{**}$ \\
+##                          & $(0.002)$     & $(0.000)$     & $(0.023)$     & $(0.242)$     & $(0.019)$     \\
+## Officer Age              &               & $-0.000^{**}$ & $-0.004^{**}$ &               &               \\
+##                          &               & $(0.000)$     & $(0.001)$     &               &               \\
+## Officer Age: 30-64       &               &               &               & $-0.495^{**}$ & $-0.096^{**}$ \\
+##                          &               &               &               & $(0.115)$     & $(0.016)$     \\
+## Officer Age: 65+         &               &               &               &               & $-0.436$      \\
+##                          &               &               &               &               & $(0.310)$     \\
+## Officer Years of Service & $-0.003^{**}$ & $0.000^{**}$  & $-0.000$      &               &               \\
+##                          & $(0.000)$     & $(0.000)$     & $(0.001)$     &               &               \\
+## Experienced Officer      &               &               &               & $-0.037$      & $0.103^{**}$  \\
+##                          &               &               &               & $(0.104)$     & $(0.014)$     \\
+## White Female             & $-0.018^{**}$ & $-0.004^{**}$ & $-0.004$      & $0.068$       & $-0.115^{**}$ \\
+##                          & $(0.004)$     & $(0.000)$     & $(0.017)$     & $(0.174)$     & $(0.019)$     \\
+## Black Male               & $0.055^{**}$  & $0.010^{**}$  & $-0.061^{**}$ & $-0.558^{**}$ & $0.184^{**}$  \\
+##                          & $(0.003)$     & $(0.000)$     & $(0.011)$     & $(0.127)$     & $(0.020)$     \\
+## Black Female             & $-0.028^{**}$ & $-0.002^{**}$ & $-0.068^{**}$ & $-0.562^{**}$ & $-0.105^{**}$ \\
+##                          & $(0.003)$     & $(0.000)$     & $(0.020)$     & $(0.208)$     & $(0.023)$     \\
+## Latino Male              &               & $0.002^{**}$  & $-0.109^{**}$ & $-1.087^{**}$ & $-0.004$      \\
+##                          &               & $(0.000)$     & $(0.013)$     & $(0.143)$     & $(0.021)$     \\
+## Latina Female            &               & $-0.003^{**}$ & $0.005$       & $0.091$       & $-0.135^{**}$ \\
+##                          &               & $(0.000)$     & $(0.032)$     & $(0.314)$     & $(0.025)$     \\
+## Driver Age               & $-0.002^{**}$ & $-0.000^{**}$ & $-0.003^{**}$ &               &               \\
+##                          & $(0.000)$     & $(0.000)$     & $(0.000)$     &               &               \\
+## Driver Age: 30-64        &               &               &               & $-0.630^{**}$ & $-0.244^{**}$ \\
+##                          &               &               &               & $(0.101)$     & $(0.014)$     \\
+## Driver Age: 65+          &               &               &               & $-1.573^{**}$ & $-0.398^{**}$ \\
+##                          &               &               &               & $(0.567)$     & $(0.023)$     \\
+## Out of State             &               & $0.003^{**}$  & $-0.065^{**}$ & $-0.864^{**}$ & $0.066^{**}$  \\
+##                          &               & $(0.000)$     & $(0.013)$     & $(0.133)$     & $(0.016)$     \\
+## \hline
+## R$^2$                    & $0.071$       & $0.012$       & $0.084$       & $0.047$       & $0.003$       \\
+## Adj. R$^2$               & $0.070$       & $0.012$       & $0.074$       & $0.045$       & $0.003$       \\
+## Num. obs.                & $79523$       & $1474530$     & $11041$       & $8045$        & $382456$      \\
+## \hline
+## \multicolumn{6}{l}{\scriptsize{$^{**}p<0.01$; $^{*}p<0.05$}}
+## \end{tabular}
+## \caption{Statistical models}
+## \label{table:coefficients}
+## \end{center}
+## \end{table}
+
# Table 4. Driver Characteristics
+load("Data/FLInter_Search.RData")
+load("Data/FLInter_Contra.RData")
+load("Data/FLStopRate_Inter_OLS.RData")
+load("Data/FLSearchRate_Inter_OLS.RData")
+load("Data/NCInter_Search.RData")
+
+texreg(list(nc.search.inter,fl.search.inter,fl.contra.inter,
+            contra.search.rate.inter,contra.stop.rate.inter),
+          stars=c(0.01,0.05),
+          custom.coef.map = list("factor(of_gender)1"="Female Officer",
+                                 "factor(subject_female)1"="Female Driver",
+                                 "factor(of_race)1"="Black Officer",
+                                 "factor(of_race)2"="Latinx Officer",
+                                 "factor(subject_race2)1"="Black Driver",
+                                 "factor(subject_race2)2"="Latinx Driver",
+                                 "factor(of_gender)1:factor(subject_female)1"="Female Officer*Driver",
+                                 "factor(of_race)1:factor(subject_race2)1"="Black Officer*Driver",
+                                 "factor(of_race)2:factor(subject_race2)1"="Latinx Officer*Black Driver",
+                                 "factor(of_race)1:factor(subject_race2)2"="Black Officer*Latinx Driver",
+                                 "factor(of_race)2:factor(subject_race2)2"="Latinx Officer* Driver"),digits=3)
+
## 
+## \begin{table}
+## \begin{center}
+## \begin{tabular}{l c c c c c}
+## \hline
+##  & Model 1 & Model 2 & Model 3 & Model 4 & Model 5 \\
+## \hline
+## Female Officer              & $-0.024^{**}$ & $-0.005^{**}$ & $0.111^{**}$  & $1.216^{**}$  & $-0.098^{**}$ \\
+##                             & $(0.002)$     & $(0.000)$     & $(0.034)$     & $(0.315)$     & $(0.015)$     \\
+## Female Driver               & $-0.046^{**}$ & $-0.004^{**}$ & $0.010$       & $0.956^{**}$  & $-0.071^{**}$ \\
+##                             & $(0.001)$     & $(0.000)$     & $(0.010)$     & $(0.266)$     & $(0.014)$     \\
+## Black Officer               & $-0.017^{**}$ & $-0.001^{**}$ & $0.020$       & $0.415$       & $-0.077^{**}$ \\
+##                             & $(0.002)$     & $(0.000)$     & $(0.031)$     & $(0.330)$     & $(0.014)$     \\
+## Latinx Officer              & $-0.020^{**}$ & $-0.000$      & $0.063^{*}$   & $1.338^{**}$  & $-0.032^{*}$  \\
+##                             & $(0.005)$     & $(0.000)$     & $(0.026)$     & $(0.247)$     & $(0.015)$     \\
+## Black Driver                & $0.027^{**}$  & $0.006^{**}$  & $-0.044^{**}$ & $-1.295^{**}$ & $0.035$       \\
+##                             & $(0.001)$     & $(0.000)$     & $(0.009)$     & $(0.318)$     & $(0.019)$     \\
+## Latinx Driver               & $-0.007^{**}$ & $0.002^{**}$  & $-0.075^{**}$ & $-0.800^{**}$ & $0.004$       \\
+##                             & $(0.002)$     & $(0.000)$     & $(0.012)$     & $(0.129)$     & $(0.012)$     \\
+## Female Officer*Driver       & $0.003$       & $0.003^{**}$  & $-0.042$      & $-0.315$      & $0.046$       \\
+##                             & $(0.004)$     & $(0.000)$     & $(0.068)$     & $(0.641)$     & $(0.024)$     \\
+## Black Officer*Driver        & $-0.018^{**}$ & $-0.005^{**}$ & $0.085^{*}$   & $0.790$       & $-0.056^{*}$  \\
+##                             & $(0.003)$     & $(0.000)$     & $(0.043)$     & $(0.470)$     & $(0.023)$     \\
+## Latinx Officer*Black Driver & $-0.001$      & $-0.003^{**}$ & $-0.167^{**}$ & $-1.922^{**}$ & $-0.113^{**}$ \\
+##                             & $(0.006)$     & $(0.000)$     & $(0.033)$     & $(0.350)$     & $(0.025)$     \\
+## Black Officer*Latinx Driver & $0.002$       & $-0.002^{**}$ & $0.018$       & $0.219$       & $-0.016$      \\
+##                             & $(0.005)$     & $(0.000)$     & $(0.047)$     & $(0.513)$     & $(0.024)$     \\
+## Latinx Officer* Driver      & $0.012$       & $-0.002^{**}$ & $-0.088^{**}$ & $-1.132^{**}$ & $-0.038$      \\
+##                             & $(0.008)$     & $(0.000)$     & $(0.034)$     & $(0.348)$     & $(0.023)$     \\
+## \hline
+## R$^2$                       & $0.063$       & $0.009$       & $0.132$       & $0.132$       & $0.004$       \\
+## Adj. R$^2$                  & $0.063$       & $0.009$       & $0.124$       & $0.130$       & $0.003$       \\
+## Num. obs.                   & $176332$      & $2658706$     & $12718$       & $9677$        & $747784$      \\
+## \hline
+## \multicolumn{6}{l}{\scriptsize{$^{**}p<0.01$; $^{*}p<0.05$}}
+## \end{tabular}
+## \caption{Statistical models}
+## \label{table:coefficients}
+## \end{center}
+## \end{table}
+
###
+### 8. Appendix E: A Conservative Test with the Charlotte Police Department
+###
+
+load("Data/NorthCarolina.RData")
+
+table(nc$year)
+
## 
+##  2016  2017  2019  2020 
+## 41113 46943 96498 33604
+
nc.search16 = lm(search~factor(race_gender)+subject_age+
+                   investigatory+
+                   factor(of_race)+
+                   factor(of_gender)+Officer_Years_of_Service+
+                   factor(month)+
+                   factor(CMPD_Division),
+                 data=nc,subset=nc$year==2016)
+nc.search17 = lm(search~factor(race_gender)+subject_age+
+                   investigatory+
+                   factor(of_race)+
+                   factor(of_gender)+Officer_Years_of_Service+
+                   factor(month)+
+                   factor(CMPD_Division),
+                 data=nc,subset=nc$year==2017)
+nc.search19 = lm(search~factor(race_gender)+subject_age+
+                   investigatory+
+                   factor(of_race)+
+                   factor(of_gender)+Officer_Years_of_Service+
+                   factor(month)+
+                   factor(CMPD_Division),
+                 data=nc,subset=nc$year==2019)
+nc.search20 = lm(search~factor(race_gender)+subject_age+
+                   investigatory+
+                   factor(of_race)+
+                   factor(of_gender)+Officer_Years_of_Service+
+                   factor(month)+
+                   factor(CMPD_Division),
+                 data=nc,subset=nc$year==2020)
+texreg(list(nc.search16,nc.search17,nc.search19,nc.search20),
+       omit.coef = "Division*|month*",
+       custom.coef.map = list("(Intercept)"="(Intercept)",
+                              "factor(of_gender)1"="Female Officer",
+                              "factor(of_race)1"="Black Officer",
+                              "Officer_Years_of_Service"="Officer Years of Service",
+                              "investigatory"="Investigatory Stop",
+                              "factor(race_gender)1"="White Female",
+                              "factor(race_gender)2"="Black Male",
+                              "factor(race_gender)3"="Black Female",
+                              "subject_age"="Driver Age"),
+       stars=c(0.01,0.05))
+
## 
+## \begin{table}
+## \begin{center}
+## \begin{tabular}{l c c c c}
+## \hline
+##  & Model 1 & Model 2 & Model 3 & Model 4 \\
+## \hline
+## (Intercept)              & $0.10^{**}$  & $0.09^{**}$  & $0.09^{**}$  & $0.10^{**}$  \\
+##                          & $(0.01)$     & $(0.01)$     & $(0.01)$     & $(0.01)$     \\
+## Female Officer           & $-0.03^{**}$ & $-0.03^{**}$ & $-0.02^{**}$ & $-0.02^{**}$ \\
+##                          & $(0.00)$     & $(0.00)$     & $(0.00)$     & $(0.01)$     \\
+## Black Officer            & $-0.03^{**}$ & $-0.03^{**}$ & $-0.03^{**}$ & $-0.04^{**}$ \\
+##                          & $(0.00)$     & $(0.00)$     & $(0.00)$     & $(0.00)$     \\
+## Officer Years of Service & $-0.00^{**}$ & $-0.00^{**}$ & $-0.00^{**}$ & $-0.00^{**}$ \\
+##                          & $(0.00)$     & $(0.00)$     & $(0.00)$     & $(0.00)$     \\
+## Investigatory Stop       & $0.02^{**}$  & $0.02^{**}$  & $0.03^{**}$  & $0.04^{**}$  \\
+##                          & $(0.00)$     & $(0.00)$     & $(0.00)$     & $(0.00)$     \\
+## White Female             & $-0.01^{**}$ & $-0.00$      & $-0.01^{**}$ & $-0.01$      \\
+##                          & $(0.00)$     & $(0.00)$     & $(0.00)$     & $(0.01)$     \\
+## Black Male               & $0.04^{**}$  & $0.05^{**}$  & $0.04^{**}$  & $0.04^{**}$  \\
+##                          & $(0.00)$     & $(0.00)$     & $(0.00)$     & $(0.00)$     \\
+## Black Female             & $-0.02^{**}$ & $-0.01^{**}$ & $-0.02^{**}$ & $-0.03^{**}$ \\
+##                          & $(0.00)$     & $(0.00)$     & $(0.00)$     & $(0.01)$     \\
+## Driver Age               & $-0.00^{**}$ & $-0.00^{**}$ & $-0.00^{**}$ & $-0.00^{**}$ \\
+##                          & $(0.00)$     & $(0.00)$     & $(0.00)$     & $(0.00)$     \\
+## \hline
+## R$^2$                    & $0.07$       & $0.06$       & $0.08$       & $0.09$       \\
+## Adj. R$^2$               & $0.07$       & $0.06$       & $0.08$       & $0.09$       \\
+## Num. obs.                & $31275$      & $34701$      & $64501$      & $20070$      \\
+## \hline
+## \multicolumn{5}{l}{\scriptsize{$^{**}p<0.01$; $^{*}p<0.05$}}
+## \end{tabular}
+## \caption{Statistical models}
+## \label{table:coefficients}
+## \end{center}
+## \end{table}
+ + + + +
+ + + + + + + + + + + + + + + diff --git a/108/replication_package/readme.txt b/108/replication_package/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b2d472c03da43d60f6492064a07cb363d1164ee --- /dev/null +++ b/108/replication_package/readme.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74f239b3f2c53f1d2a2c12e09fb910f07bdf259e7f378094f9800134259a4a5f +size 6342 diff --git a/108/should_reproduce.txt b/108/should_reproduce.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c00662aed315f8e4258afee160b8e9689371266 --- /dev/null +++ b/108/should_reproduce.txt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed84099e646fd7df2578db547fe6adea3c80c18b60c683f4fed2cd40a5a587d2 +size 49