--- title: "Detention Survey Final Draft Analysis" author: "Matthew Denney" date: "1/28/2021" output: pdf_document editor_options: chunk_output_type: console --- # This is code for data from the Yale Cooperative Lucid Survey, week 11, # Data and code are for survey module on COVID-19 in migrant detention centers # Results are described in "Compounding Racialized Vulnerability," published in the Journal of Health Policy, Politics and Law # Initial cleaning code and weighting procedure code were adapted in part from code from Kyle Peyton and Alex Coppock ```{r} rm(list = ls()) library(tidyverse) # for easy data cleaning library(lubridate) # for working w/ dates library(readxl) library(autumn) library(estimatr) library(reshape2) ``` ```{r} dat <- read_csv("D:/ISPS Data Archive processing/D171/Files/ycls_week_11_DG.csv") dat %>% filter(Status == "IP Address", !is.na(rid), consent == "I agree to participate") ``` # administrative recodes -------------------------------------------------- ```{r} dat <- dat %>% mutate( admin_ResponseId = ResponseId, admin_StartDate = ymd_hms(StartDate), admin_EndDate = ymd_hms(EndDate), admin_RecordedDate = ymd_hms(RecordedDate), admin_duration_seconds = as.numeric(`Duration (in seconds)`), admin_duration_seconds = difftime(EndDate, StartDate, unit = "secs") ) ``` # Demographic Recodes ----------------------------------------------------- ```{r} #Duplicate household income to preserve numeric variable dat <- dat %>% mutate( lucid_hhi_numeric = case_when( hhi == 1 ~ "1", hhi == 2 ~ "3", hhi == 4 ~ "4", hhi == 5 ~ "5", hhi == 6 ~ "6", hhi == 7 ~ "7", hhi == 8 ~ "8", hhi == 9 ~ "9", hhi == 10 ~ "10", hhi == 11 ~ "11", hhi == 12 ~ "12", hhi == 13 ~ "13", hhi == 14 ~ "14", hhi == 15 ~ "15", hhi == 16 ~ "16", hhi == 17 ~ "17", hhi == 18 ~ "18", hhi == 19 ~ "19", hhi == 20 ~ "20", hhi == 21 ~ "21", hhi == 22 ~ "22", hhi == 23 ~ "$23", hhi == 24 ~ "24", hhi == -3105 ~ "NA" )) dat$lucid_hhi_numeric <- as.numeric(dat$lucid_hhi_numeric) #Continue with demographic recodes dat <- dat %>% mutate( dem_birthyr = as.numeric(dem_birthyr), dem_age = 2020 - dem_birthyr, dem_female = as.numeric(dem_gender == "Female") ) ``` ```{r} #Add straightliner variable dat <- dat %>% mutate( pol_straight_line = pol_norms_1 == pol_norms_2 & pol_norms_1 == pol_norms_2 & pol_norms_1 == pol_norms_3 & pol_norms_1 == pol_norms_4 & pol_norms_1 == pol_norms_5 & pol_norms_1 == pol_norms_6 & pol_norms_1 == pol_norms_7 & pol_norms_1 == pol_norms_8, covid_straight_line = covid_norms_1 == covid_norms_2 & covid_norms_1 == covid_norms_2 & covid_norms_1 == covid_norms_3 & covid_norms_1 == covid_norms_4 & covid_norms_1 == covid_norms_5 & covid_norms_1 == covid_norms_6 & covid_norms_1 == covid_norms_7 & covid_norms_1 == covid_norms_8 & covid_norms_1 == covid_norms_9, admin_straightliner = pol_straight_line & covid_straight_line ) ``` # Lucid demographic recodes ----------------------------------------------- ```{r} dat <- dat %>% mutate( lucid_age = as.numeric(age), lucid_education = case_when( education == 1 ~ "Some high school or less", education == 2 ~ "High school graduate", education == 3 ~ "Other post high school vocational training", education == 4 ~ "Completed some college, but no degree", education == 5 ~ "Associate's degree", education == 6 ~ "Bachelor's degree", education == 7 ~ "Master's or professional degree", education == 8 ~ "Doctorate degree", education == -3105 ~ "None of the above" ), lucid_ethnicity = case_when( ethnicity == 1 ~ "White", ethnicity == 2 ~ "Black, or African American", ethnicity == 3 ~ "American Indian or Alaska Native", ethnicity == 4 ~ "Asian *** Asian Indian", ethnicity == 5 ~ "Asian *** Chinese", ethnicity == 6 ~ "Asian *** Filipino", ethnicity == 7 ~ "Asian *** Japanese", ethnicity == 8 ~ "Asian *** Korean", ethnicity == 9 ~ "Asian *** Vietnamese", ethnicity == 10 ~ "Asian *** Other", ethnicity == 11 ~ "Pacific Islander *** Native Hawaiian", ethnicity == 12 ~ "Pacific Islander *** Guamanian", ethnicity == 13 ~ "Pacific Islander *** Samoan", ethnicity == 14 ~ "Pacific Islander *** Other Pacific Islander", ethnicity == 15 ~ "Some other race", ethnicity == 16 ~ "Prefer not to answer" ), lucid_gender = case_when(gender == 1 ~ "Male", gender == 2 ~ "Female"), lucid_female = as.numeric(lucid_gender == "Female"), lucid_hhi = case_when( hhi == 1 ~ "Less than $14,999", hhi == 2 ~ "$15,000 to $19,999", hhi == 3 ~ "$20,000 to $24,999", hhi == 4 ~ "$25,000 to $29,999", hhi == 5 ~ "$30,000 to $34,999", hhi == 6 ~ "$35,000 to $39,999", hhi == 7 ~ "$40,000 to $44,999", hhi == 8 ~ "$45,000 to $49,999", hhi == 9 ~ "$50,000 to $54,999", hhi == 10 ~ "$55,000 to $59,999", hhi == 11 ~ "$60,000 to $64,999", hhi == 12 ~ "$65,000 to $69,999", hhi == 13 ~ "$70,000 to $74,999", hhi == 14 ~ "$75,000 to $79,999", hhi == 15 ~ "$80,000 to $84,999", hhi == 16 ~ "$85,000 to $89,999", hhi == 17 ~ "$90,000 to $94,999", hhi == 18 ~ "$95,000 to $99,999", hhi == 19 ~ "$100,000 to $124,999", hhi == 20 ~ "$125,000 to $149,999", hhi == 21 ~ "$150,000 to $174,999", hhi == 22 ~ "$175,000 to $199,999", hhi == 23 ~ "$200,000 to $249,999", hhi == 24 ~ "$250,000 and above", hhi == -3105 ~ "Prefer not to answer" ), lucid_hispanic_full = case_when( hispanic == 1 ~ "No , not of Hispanic, Latino, or Spanish origin", hispanic == 2 ~ "Yes, Mexican, Mexican American, Chicano", hispanic == 3 ~ "Yes, Cuban", hispanic == 4 ~ "Yes, another Hispanic, Latino, or Spanish origin *** Argentina ", hispanic == 5 ~ "Yes, another Hispanic, Latino, or Spanish origin *** Colombia ", hispanic == 6 ~ "Yes, another Hispanic, Latino, or Spanish origin *** Ecuador ", hispanic == 7 ~ "Yes, another Hispanic, Latino, or Spanish origin *** El Salvadore ", hispanic == 8 ~ "Yes, another Hispanic, Latino, or Spanish origin *** Guatemala ", hispanic == 9 ~ "Yes, another Hispanic, Latino, or Spanish origin *** Nicaragua ", hispanic == 10 ~ "Yes, another Hispanic, Latino, or Spanish origin *** Panama ", hispanic == 11 ~ "Yes, another Hispanic, Latino, or Spanish origin *** Peru ", hispanic == 12 ~ "Yes, another Hispanic, Latino, or Spanish origin *** Spain ", hispanic == 13 ~ "Yes, another Hispanic, Latino, or Spanish origin *** Venezuela ", hispanic == 14 ~ "Yes, another Hispanic, Latino, or Spanish origin *** Other Country", hispanic == 15 ~ "Prefer not to answer" ), lucid_hispanic = as.numeric(hispanic != 1), lucid_pid_7n = case_when( political_party == 1 ~ 1, # Strong D political_party == 2 ~ 2, # Not v. strong D political_party == 3 ~ 3, # Independent D political_party == 4 ~ 4, # Pure independent political_party == 5 ~ 5, # Independent R political_party == 6 ~ 3, # Lean Democrat political_party == 7 ~ 4, # Independent political_party == 8 ~ 5, # Lean Republican political_party == 9 ~ 6, # Not v. strong R political_party == 10 ~ 7 # Strong R ), lucid_pid_7 = case_when( lucid_pid_7n == 1 ~ "Strong Democrat", #lucid_pid_7n == 2 ~ "Not a strong Democrat", lucid_pid_7n == 2 ~ "Weak Democrat", lucid_pid_7n == 3 ~ "Lean Democrat", #lucid_pid_7n == 4 ~ "Pure Independent", lucid_pid_7n == 4 ~ "Independent", lucid_pid_7n == 5 ~ "Lean Republican", #lucid_pid_7n == 6 ~ "Closer to Republican", lucid_pid_7n == 6 ~ "Weak Republican", lucid_pid_7n == 7 ~ "Strong Republican" ), lucid_pid_7_factor = factor( lucid_pid_7, levels = c( "Strong Democrat", "Weak Democrat", "Lean Democrat", "Independent", "Lean Republican", "Weak Republican", "Strong Republican" ) ), lucid_region = case_when( region == 1 ~ "Northeast", region == 2 ~ "Midwest", region == 3 ~ "South", region == 4 ~ "West" ), lucid_zip = zip ) ``` # politics recodes -------------------------------------------------------- ```{r} dat <- dat %>% mutate( pol_ideo_7n = recode( pol_ideo7, `Extremely Liberal` = 1, `Liberal` = 2, `Slightly Liberal` = 3, `Moderate, Middle of Road` = 4, `Slightly Conservative` = 5, `Conservative` = 6, `Extremely Conservative` = 7, ), pol_ideo_3 = case_when( pol_ideo_7n %in% 1:3 ~ "Liberal", pol_ideo_7n == 4 ~ "Moderate", pol_ideo_7n %in% 5:7 ~ "Conservative" ) ) ``` # study-specific recodes -------------------------------------------------- #COVID-19 in detention centers ```{r} dat_cleaned <- dat %>% select( starts_with("admin_"), starts_with("dem_"), starts_with("lucid_"), starts_with("pol_"), starts_with("psv_"), starts_with("Z_dg"), starts_with("dengar_"), starts_with("covid_prison"), starts_with("admin_straightliner") ) ``` ##Conduct weighting procedure #Align variables of survey data set with weighting data set ```{r} #Create pan-racial groups #Ethnicity data mapping_Weth <- c("American Indian or Alaska Native" = "Other race","Asian *** Asian Indian" = "AAPI", "Asian *** Chinese" = "AAPI", "Asian *** Filipino" = "AAPI", "Asian *** Japanese" = "AAPI", "Asian *** Korean" = "AAPI", "Asian *** Other" = "AAPI", "Asian *** Vietnamese " = "AAPI", "Black, or African American" = "Black", "Pacific Islander*** Native Hawaiian" = "AAPI", "Pacific Islander *** Other Pacific Islander" = "AAPI", "Prefer not to answer" = "Other race", "Some other race" = "Other race", "White" = "White") dat_cleaned$Wrace <- mapping_Weth[dat_cleaned$lucid_ethnicity] table(dat_cleaned$Wrace) #Modify income variable to match weighting procedure mapping_Whhi <- c("$100,000 to $124,999" = "$100,000 - $124,999", "$125,000 to $149,999" = "$125,000 - $199,999", "$15,000 to $19,999" = "$19,999 or less", "Less than $14,999" = "$19,999 or less", "$20,000 to $24,999" = "$20,000 - $34,999", "$25,000 to $29,999" = "$20,000 - $34,999", "$200,000 to $249,999" = "$200,000 and above", "$250,000 and above" = "$200,000 and above", "$35,000 to $39,999" = "$35,000 - $49,999", "$40,000 to $44,999" = "$35,000 - $49,999", "$45,000 to $49,999", "$50,000 to $54,999" = "$50,000 - $64,999", "$55,000 to $59,999" = "$50,000 - $64,999", "$60,000 to $64,999" = "$50,000 - $64,999", "$65,000 to $69,999" = "$65,000 - $79,999", "$70,000 to $74,999", "$70,000 to $74,999" = "$65,000 - $79,999", "$75,000 to $79,999" = "$65,000 - $79,999", "$80,000 to $84,999" = "$80,000 - $99,999", "$85,000 to $89,999" = "$80,000 - $99,999", "$90,000 to $94,999" = "$80,000 - $99,999", "$95,000 to $99,999" = "$80,000 - $99,999", "Prefer not to answer" = "Unanswered") dat_cleaned$Whousehold_income <- mapping_Whhi[dat_cleaned$lucid_hhi] table(dat_cleaned$Whousehold_income) #Modify education variable to match weighting procedure table(dat_cleaned$lucid_education) mapping_Weducation <- c("Associate's degree" = "Associate's degree", "Bachelor's degree" = "Bachelor's degree", "Master's or professional degree" = "Graduate degree", "Doctorate degree" = "Graduate degree", "High school graduate" = "High school diploma", "None of the above" = "No high school diploma", "Some high school or less" = "No high school diploma", "Completed some college, but no degree" = "Some college") dat_cleaned$Weducation <- mapping_Weducation[dat_cleaned$lucid_education] table(dat_cleaned$Weducation) #Create new age variable to match weights lucid_age <- dat_cleaned$lucid_age dat_cleaned$Wage <- cut(lucid_age, breaks=c(17, 23, 29,39,49,59,69,108, include.lowest = FALSE, right = TRUE)) table(dat_cleaned$Wage) #Adjust age variable to match weights dat_cleaned <- dat_cleaned %>% mutate( Wage = case_when( Wage == "(17,23]" ~ "18-23", Wage == "(23,29]" ~ "24-29", Wage == "(29,39]" ~ "30-39", Wage == "(39,49]" ~ "40-49", Wage == "(49,59]" ~ "50-59", Wage == "(59,69]" ~ "60-69", Wage == "(69,108]" ~ "70+", )) ``` #Perform weighting procedure itself ```{r} ## Read in nationscape weights target_pop <- read_rds("D:/ISPS Data Archive processing/D171/From authors 20210628/nationscape_target_list.rds") ## Exclude variables we do not have in lucid dataset; do not apply voting ## weights. Ignore joint dist weights and focus on marginals for the things ## we have. target_pop <- target_pop %>% list_modify("Wlanguage" = NULL, "Wurban" = NULL, "Whispanic_x_language" = NULL, "Weducation_x_gender" = NULL, "Whispanic_x_education" = NULL, "Wgender_x_race" = NULL, "Wrace_x_hispanic" = NULL, "Wrace_x_education" = NULL, "Wrace_x_age" = NULL, "Whispanic_x_age" = NULL, "Wvote_2016" = NULL, "Wbirthplace" = NULL, "Whispanic" = NULL) # Normalize weights to sum to 1! target_pop <- lapply(target_pop, function(x) x / sum(x)) #Create any other variables as needed to match weights dat_cleaned$Wgender <- dat_cleaned$lucid_gender dat_cleaned$Wregion <- dat_cleaned$lucid_region dat_cleaned$Whispanic <- dat_cleaned$lucid_hispanic # Generate survey weights weighted_dat <- harvest(dat_cleaned, target = target_pop, max_weight = 2.5) #harvest(dat_cleaned, target = target_pop, error_function = "meansquared") ## Check divergence between lucid data and target pop. get_current_miss(weighted_dat, target = target_pop) ## variance inflation caused by weights #design_effect(weighted_dat$weights, outcome = weighted_dat$Z_dg) effective_sample_size(weighted_dat$weights) diagnose_dat <- weighted_dat %>% diagnose_weights() ## Visualise some differences ggplot(diagnose_dat, aes(y = error_original, x = error_weighted)) + geom_point() + geom_abline(slope = 1, intercept = 0, lty = 2) + scale_x_continuous(limits = c(0, 0.15)) + scale_y_continuous(limits = c(0, 0.15)) + facet_wrap( ~ variable) + xlab("Error after weighting") + ylab("Error before weighting") + theme_bw() ggplot(diagnose_dat, aes(x = prop_original, y = prop_weighted)) + geom_point() + geom_abline(slope = 1, intercept = 0, lty = 2) + facet_wrap( ~ variable) + xlab("Unweighted proportions") + ylab("Weighted proportions") + theme_bw() dat_cleaned <- weighted_dat ``` #Survey specific recodes ```{r} #Turning Likert Scales to Numeric ##Prison Action 1 mapping1 <- c("Strongly Disagree" = 0,"Disagree" = 1,"Neither Agree Nor Disagree" = 2, "Agree" = 3, "Strongly Agree" = 4) #Detention Action 1 dat_cleaned$dengar_deten_agr_1 <- mapping1[dat_cleaned$dengar_deten_agr_1] #Detention Action 2 dat_cleaned$dengar_deten_agr_2 <- mapping1[dat_cleaned$dengar_deten_agr_2] #Detention Action 3 dat_cleaned$dengar_deten_agr_3 <- mapping1[dat_cleaned$dengar_deten_agr_3] #Detention Action 4 dat_cleaned$dengar_deten_agr_4 <- mapping1[dat_cleaned$dengar_deten_agr_4] #Detention Action 5 dat_cleaned$dengar_deten_agr_5 <- mapping1[dat_cleaned$dengar_deten_agr_5] #Detention in General mapping3 <- c("Not enough" = 0,"About the right amount" = 1,"Don't know/No opinion" = 1, "Too many" = 2) dat_cleaned$dengar_detain_amount <- mapping3[dat_cleaned$dengar_detain_amount] #Thought mapping4 <- c("We should address COVID-19 inside detention centers to prevent spread to American citizens." = 2,"COVID-19 in detention centers should not be our priority because the detainees are not American." = 1,"Immigrants in detention should bear COVID-19 as part of their punishment for coming to the U.S. without authorization." = 0, "We should address COVID-19 inside detention centers to protect the human rights of detainees." = 3) dat_cleaned$dengar_covid_dention <- mapping4[dat_cleaned$dengar_covid_dention] ``` ```{r} #Create version with NAs removed dat_cleaned_noNAs <- dat_cleaned %>% filter(!is.na(dengar_deten_agr_1)) %>% filter(!is.na(dengar_deten_agr_2)) %>% filter(!is.na(dengar_deten_agr_3)) %>% filter(!is.na(dengar_deten_agr_4)) %>% filter(!is.na(dengar_deten_agr_5)) %>% filter(!is.na(dengar_detain_amount)) %>% filter(!is.na(dengar_covid_dention)) %>% filter(admin_straightliner == FALSE) #Create data set with straightliners removed dat_cleaned_nostraightliner <- dat_cleaned %>% filter(admin_straightliner == FALSE) straightliners <- filter(dat_cleaned, admin_straightliner == "TRUE") straightliners <- straightliners %>% select(starts_with("dengar")) dat_cleaned_straightliners_removed <- dat_cleaned %>% filter(admin_straightliner == FALSE) ``` ```{r} #Create Latinx Category within race dat_cleaned_lat <- mutate(dat_cleaned, lucid_ethnicity = ifelse(lucid_hispanic == 1, "Latinx", lucid_ethnicity)) #Create pan-racial groups #Ethnicity data mappingeth <- c("American Indian or Alaska Native" = "Other","Asian *** Asian Indian" = "Asian", "Asian *** Chinese" = "Asian", "Asian *** Filipino" = "Asian", "Asian *** Japanese" = "Asian", "Asian *** Korean" = "Asian", "Asian *** Other" = "Asian", "Asian *** Vietnamese " = "Asian", "Black, or African American" = "Black", "Pacific Islander*** Native Hawaiian" = "Other", "Prefer not to answer" = "Other", "Some other race" = "Other", "White" = "White", "Latinx" = "Latinx") dat_cleaned_lat$lucid_ethnicity <- mappingeth[dat_cleaned_lat$lucid_ethnicity] #Create Latinx data frame dat_lat <- filter(dat_cleaned_lat, lucid_ethnicity == "Latinx") #Subsetting by race dat_white <- filter(dat_cleaned_lat, lucid_ethnicity == "White") dat_black <- filter(dat_cleaned_lat, lucid_ethnicity == "Black") dat_bw <- filter(dat_cleaned_lat, lucid_ethnicity == "White" | lucid_ethnicity == "Black") dat_bwwom <- filter(dat_bw, lucid_gender == "Female") dat_bwl <- filter(dat_cleaned_lat, lucid_ethnicity == "White" | lucid_ethnicity == "Black" | lucid_ethnicity == "Latinx") #Subsetting by treatment dat_treat <- filter(dat_cleaned_lat, Z_dg == "1") dat_control <- filter(dat_cleaned_lat, Z_dg == "0") ``` #Treatment effects ```{r} #Looking at effect of treatment on COVID responses OLS1 <- lm(dengar_deten_agr_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS1) OLS2 <- lm(dengar_deten_agr_2 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS2) OLS3 <- lm(dengar_deten_agr_3 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS3) OLS4 <- lm(dengar_deten_agr_4 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS4) OLS4w <- lm(dengar_deten_agr_4 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, weights = weights, data = dat_cleaned) summary(OLS4w) OLS5 <- lm(dengar_deten_agr_5 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS5) OLS6 <- lm(dengar_slider_covid_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS6) OLS7 <- lm(dengar_slider_covid_2 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS7) OLS8 <- lm(dengar_slider_covid_3 ~ Z_dg + lucid_pid_7n + lucid_gender, data = dat_cleaned) summary(OLS8) OLS9 <- lm(dengar_slider_gen_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS9) OLS10 <- lm(dengar_slider_gen_2 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS10) OLS11 <- lm(dengar_slider_gen_3 ~ Z_dg + lucid_pid_7n + lucid_gender, data = dat_cleaned) summary(OLS11) OLS12 <- lm(dengar_detain_amount ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS12) OLS13 <- lm(dengar_covid_dention ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS13) ``` ```{r} #Correlation between general views on COVID-19 in migrant detention centers and policy preferences OLS_thought1 <- lm(dengar_deten_agr_1 ~ dengar_covid_dention + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS_thought1) OLS_thought2 <- lm(dengar_deten_agr_2 ~ dengar_covid_dention + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS_thought2) OLS_thought3 <- lm(dengar_deten_agr_3 ~ dengar_covid_dention + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS_thought3) OLS_thought4 <- lm(dengar_deten_agr_4 ~ dengar_covid_dention + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS_thought4) OLS_thought5 <- lm(dengar_deten_agr_5 ~ dengar_covid_dention + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS_thought5) ``` ```{r} #Looking at just white respondents #Looking at effect of treatment on COVID responses OLSw1 <- lm(dengar_deten_agr_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_white) summary(OLSw1) OLSw2 <- lm(dengar_deten_agr_2 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_white) summary(OLSw2) OLSw3 <- lm(dengar_deten_agr_3 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_white) summary(OLSw3) OLSw4 <- lm(dengar_deten_agr_4 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_white) summary(OLSw4) OLSw5 <- lm(dengar_deten_agr_5 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_white) summary(OLSw5) OLSw6 <- lm(dengar_slider_covid_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_white) summary(OLSw6) OLSw7 <- lm(dengar_slider_covid_2 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_white) summary(OLSw7) OLSw8 <- lm(dengar_slider_covid_3 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_white) summary(OLSw8) OLSw9 <- lm(dengar_slider_gen_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_white) summary(OLSw9) OLSw10 <- lm(dengar_slider_gen_2 ~ Z_dg + lucid_pid_7n + lucid_gender, data = dat_white) summary(OLSw10) OLSw11 <- lm(dengar_slider_gen_3 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_white) summary(OLSw11) OLSw12 <- lm(dengar_detain_amount ~ Z_dg + lucid_pid_7n + lucid_gender, data = dat_white) summary(OLSw12) OLSw13 <- lm(dengar_covid_dention ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_white) summary(OLSw13) ``` ```{r} #Looking at just black respondents #Looking at effect of treatment on COVID responses OLSb1 <- lm(dengar_deten_agr_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_black) summary(OLSb1) OLSb2 <- lm(dengar_deten_agr_2 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_black) summary(OLSb2) OLSb3 <- lm(dengar_deten_agr_3 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_black) summary(OLSb3) OLSb4 <- lm(dengar_deten_agr_4 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_black) summary(OLSb4) OLSb5 <- lm(dengar_deten_agr_5 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_black) summary(OLSb5) OLSb6 <- lm(dengar_slider_covid_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_black) summary(OLSb6) OLSb7 <- lm(dengar_slider_covid_2 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_black) summary(OLSb7) OLSb8 <- lm(dengar_slider_covid_3 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_black) summary(OLSb8) OLSb9 <- lm(dengar_slider_gen_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_black) summary(OLSb9) OLSb10 <- lm(dengar_slider_gen_2 ~ Z_dg + lucid_pid_7n + lucid_gender, data = dat_black) summary(OLSb10) OLSb11 <- lm(dengar_slider_gen_3 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_black) summary(OLSb11) OLSb12 <- lm(dengar_detain_amount ~ Z_dg + lucid_pid_7n + lucid_gender, data = dat_black) summary(OLSb12) OLSb13 <- lm(dengar_covid_dention ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_black) summary(OLSb13) ``` ```{r} #Looking at just latinx respondents #Looking at effect of treatment on COVID responses OLSL1 <- lm(dengar_deten_agr_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_lat) summary(OLSL1) OLSL2 <- lm(dengar_deten_agr_2 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_lat) summary(OLSL2) OLSL3 <- lm(dengar_deten_agr_3 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_lat) summary(OLSL3) OLSL4 <- lm(dengar_deten_agr_4 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_lat) summary(OLSL4) OLSL5 <- lm(dengar_deten_agr_5 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_lat) summary(OLSL5) OLSL6 <- lm(dengar_slider_covid_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_lat) summary(OLSL6) OLSl7 <- lm(dengar_slider_covid_2 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_lat) summary(OLSl7) OLSL8 <- lm(dengar_slider_covid_3 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_lat) summary(OLSL8) OLSL9 <- lm(dengar_slider_gen_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_lat) summary(OLSL9) OLSL10 <- lm(dengar_slider_gen_2 ~ Z_dg + lucid_pid_7n + lucid_gender, data = dat_lat) summary(OLSL10) OLSL11 <- lm(dengar_slider_gen_3 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_lat) summary(OLSL11) OLSL12 <- lm(dengar_detain_amount ~ Z_dg + lucid_pid_7n + lucid_gender, data = dat_lat) summary(OLSL12) OLSL13 <- lm(dengar_covid_dention ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_lat) summary(OLSL13) ``` ##Graphs #Summary of policy preferences #Figure 2b in text ```{r} #Using weighted data #Create variables in data applying weights to relevant categories #Make sure data.table package is detached to prevent warning/error #It's possible it may be necessary to detach data.table #detach("package:data.table", unload=TRUE) #Now, continue descriptive <- mutate(dat_cleaned, action1_weighted = dengar_deten_agr_1*weights) descriptive <- mutate(descriptive, action2_weighted = dengar_deten_agr_2*weights) descriptive <- mutate(descriptive, action3_weighted = dengar_deten_agr_3*weights) descriptive <- mutate(descriptive, action4_weighted = dengar_deten_agr_4*weights) descriptive <- mutate(descriptive, action5_weighted = dengar_deten_agr_5*weights) descriptive <- mutate(descriptive, thought_weighted = dengar_covid_dention*weights) #Create data frame with weighted means new <- descriptive %>% summarise_at(vars(c("action1_weighted", "action2_weighted", "action3_weighted", "action4_weighted", "action5_weighted")), funs(mean), na.rm = TRUE) melted_new <- new %>% melt() #Graph figure2_weighted <- ggplot(melted_new, aes(x=variable, y=value)) + geom_bar(stat="identity", position= position_dodge2())+ theme_bw() + labs(title = "Policy Preferences on COVID-19 in Detention Centers") + theme( plot.title = element_text(hjust = 0.5), plot.subtitle = element_text(hjust = 0.5)) + xlab("Policy Proposal") + ylab("Mean Response (weighted)") + scale_x_discrete(labels=c("action1_weighted" = "Increasing PPE", "action2_weighted" = "Releasing vulnerable", "action3_weighted" = "Releasing as many as possible","action4_weighted" = "Providing medical care", "action5_weighted" = "Expediting deportations")) + theme(axis.text.x = element_text(angle = 15, hjust = .8, colour = "black"), axis.text.y = element_text(colour = "black")) #Figure 2b in text figure2_weighted #Using unweighted sample new2 <- dat_cleaned %>% summarise_at(vars(c("dengar_deten_agr_1", "dengar_deten_agr_2","dengar_deten_agr_3","dengar_deten_agr_4", "dengar_deten_agr_5")), funs(mean), na.rm = TRUE) melted_new2 <- new2 %>% melt() figure2_unweighted <- ggplot(melted_new2, aes(x=variable, y=value)) + geom_bar(stat="identity", position= position_dodge2())+ theme_bw() + labs(title = "Policy Preferences on COVID-19 in Detention Centers") + theme( plot.title = element_text(hjust = 0.5), plot.subtitle = element_text(hjust = 0.5)) + xlab("Policy Proposal") + ylab("Mean Response (Unweighted)") + scale_x_discrete(labels=c("dengar_deten_agr_1" = "Increasing PPE", "dengar_deten_agr_2" = "Releasing vulnerable", "dengar_deten_agr_3" = "Releasing as many as possible","dengar_deten_agr_4" = "Providing medical care", "dengar_deten_agr_5" = "Expediting deportations")) + theme(axis.text.x = element_text(angle = 15, hjust = .8, colour = "black"), axis.text.y = element_text(colour = "black")) #Figure 23 in appendix figure2_unweighted ``` #Policy Preferences, conditioning on general thoughts #Figure 3b in text ```{r} #Using weighed sample ##Create averages for each policy preferences based on thought act1_thought_weighted <- aggregate(action1_weighted ~ dengar_covid_dention, descriptive, mean) act2_thought_weighted <- aggregate(action2_weighted ~ dengar_covid_dention, descriptive, mean) act3_thought_weighted <- aggregate(action3_weighted ~ dengar_covid_dention, descriptive, mean) act4_thought_weighted <- aggregate(action4_weighted ~ dengar_covid_dention, descriptive, mean) act5_thought_weighted <- aggregate(action5_weighted ~ dengar_covid_dention, descriptive, mean) ##Melt all of these data frames act1_thought_weighted <- act1_thought_weighted %>% melt("dengar_covid_dention") act2_thought_weighted <- act2_thought_weighted %>% melt("dengar_covid_dention") act3_thought_weighted <- act3_thought_weighted %>% melt("dengar_covid_dention") act4_thought_weighted <- act4_thought_weighted %>% melt("dengar_covid_dention") act5_thought_weighted <- act5_thought_weighted %>% melt("dengar_covid_dention") ##Combine data frames act_all_thought_weighted <- rbind(act1_thought_weighted, act2_thought_weighted, act3_thought_weighted, act4_thought_weighted, act5_thought_weighted) act_all_thought_weighted$dengar_covid_dention <- as.factor(act_all_thought_weighted$dengar_covid_dention) #Graph DET Policy Preferences, Conditioning on General Views figure3_weighted <- ggplot(act_all_thought_weighted, aes(x=factor(variable), y=value, fill=factor(dengar_covid_dention))) + geom_bar(stat="identity", position= position_dodge2()) + theme_bw() + labs(title = "Policy Preferences, Conditional on Views of COVID-19 in Detention Centers") + ylab("Mean response (weighted)") + xlab("Policy Proposal") + theme(axis.text.x = element_text(angle = 15, hjust = .75, vjust = .95, colour = "black"), axis.text.y = element_text(colour = "black"), plot.title = element_text(size=13, hjust = .12)) + scale_x_discrete(labels=c("action1_weighted" = "Increasing PPE", "action2_weighted" = "Releasing vulnerable", "action3_weighted" = "Releasing as many as possible", "action4_weighted" = "Medical care for released", "action5_weighted" = "Expediting scheduled deportations")) + scale_fill_discrete(name = "General View", labels = c("Part of punishment", "Not priority, not American", "Adress to protect Americans", "Human rights issue")) #Figure 3b in text, version with color (not used b/c greyscale required) figure3_weighted #Using unweighted sample ##Create averages for each policy preferences based on thought act1_thought <- aggregate(dengar_deten_agr_1 ~ dengar_covid_dention, dat_cleaned_lat, mean) act2_thought <- aggregate(dengar_deten_agr_2 ~ dengar_covid_dention, dat_cleaned_lat, mean) act3_thought <- aggregate(dengar_deten_agr_3 ~ dengar_covid_dention, dat_cleaned_lat, mean) act4_thought <- aggregate(dengar_deten_agr_4 ~ dengar_covid_dention, dat_cleaned_lat, mean) act5_thought <- aggregate(dengar_deten_agr_5 ~ dengar_covid_dention, dat_cleaned_lat, mean) ##Melt all of these data frames act1_thought <- act1_thought %>% melt("dengar_covid_dention") act2_thought <- act2_thought %>% melt("dengar_covid_dention") act3_thought <- act3_thought %>% melt("dengar_covid_dention") act4_thought <- act4_thought %>% melt("dengar_covid_dention") act5_thought <- act5_thought %>% melt("dengar_covid_dention") ##Combine data frames act_all_thought <- rbind(act1_thought, act2_thought, act3_thought, act4_thought, act5_thought) act_all_thought$dengar_covid_dention <- as.factor(act_all_thought$dengar_covid_dention) #DET Policy Preferences, Conditioning on General Views figure3_unweighted <- ggplot(act_all_thought, aes(x=factor(variable), y=value, fill=factor(dengar_covid_dention))) + geom_bar(stat="identity", position= position_dodge2()) + theme_bw() + labs(title = "Policy Prefs., Cond. on Views of COVID-19 in Detention Centers") + ylab("Mean response (unweighted)") + xlab("Policy Proposal") + theme(axis.text.x = element_text(angle = 15, hjust = .75, vjust = .95, colour = "black"), axis.text.y = element_text(colour = "black"), plot.title = element_text(size=13, hjust = .12)) + scale_x_discrete(labels=c("dengar_deten_agr_1" = "Increasing PPE", "dengar_deten_agr_2" = "Releasing vulnerable", "dengar_deten_agr_3" = "Releasing as many as possible", "dengar_deten_agr_4" = "Medical care for released", "dengar_deten_agr_5" = "Expediting scheduled deportations")) + scale_fill_discrete(name = "General View", labels = c("Part of punishment", "Not priority, not American", "Adress to protect Americans", "Human rights issue")) #Figure 24 in appendix figure3_unweighted ##Grey-scale for weighted, to be used in text #PJ Policy Preferences, Conditioning on General Views figure3_weighted_bw <- ggplot(act_all_thought_weighted, aes(x=factor(variable), y=value, fill=factor(dengar_covid_dention))) + geom_bar(stat="identity", position= position_dodge2()) + theme_bw() + labs(title = "Policy Preferences, Conditional on Views of COVID-19 in Detention Centers") + ylab("Mean response (weighted)") + xlab("Policy Proposal") + theme(axis.text.x = element_text(angle = 15, hjust = .75, vjust = .95, colour = "black"), axis.text.y = element_text(colour = "black"), plot.title = element_text(size=12.5, hjust = .12)) + scale_x_discrete(labels=c("action1_weighted" = "Increasing PPE*", "action2_weighted" = "Releasing vulnerable*", "action3_weighted" = "Releasing as many as possible*", "action4_weighted" = "Medical care for released*", "action5_weighted" = "Expediting scheduled deportations")) + scale_fill_grey(name = "General View", labels=c("Part of punishment", "Not priority, not American", "Adress to protect Americans", "Human rights issue"), start = 0, end = .9) #Figure 3b in text figure3_weighted_bw ``` #General Coefficent Plot #Figure 4b in text ```{r} #Recover coefficients and CIs into data frame coeffs <- matrix(data = c(OLS1$coeff[2], OLS2$coeff[2], OLS3$coeff[2], OLS4$coeff[2], OLS5$coeff[2], OLS12$coeff[2], OLS13$coeff[2])) conf.low <- matrix(data = c(confint(OLS1)[2,1], confint(OLS2)[2,1], confint(OLS3)[2,1], confint(OLS4)[2,1], confint(OLS5)[2,1], confint(OLS12)[2,1], confint(OLS13)[2,1])) conf.high <- matrix(data = c(confint(OLS1)[2,2], confint(OLS2)[2,2], confint(OLS3)[2,2], confint(OLS4)[2,2], confint(OLS5)[2,2], confint(OLS12)[2,2], confint(OLS13)[2,2])) treatment <- matrix(data = c(7, 6, 5, 4, 3, 2, 1)) df_figure <- data.frame(treatment, coeffs, conf.low, conf.high) figure4 <- ggplot(df_figure, aes(x = coeffs, y = treatment)) + geom_vline(xintercept = 0, lwd = I(4/12), alpha = I(7/12), colour = "black") + geom_errorbarh(aes(xmin = conf.low, xmax = conf.high), size = 1, width = 0, show.legend = FALSE, position = position_dodge(width = 0.5), colour = "black") + geom_point(size = 2, position = position_dodge(width = 0.5), colour = "black") + scale_shape_manual(values = c(16, 15)) + scale_color_manual(name = "", values = c("black")) + theme_bw() + theme(plot.title = element_text(hjust = .3, size = 12), axis.text.x = element_text(colour = "black"), axis.text.y = element_text(colour = "black")) + scale_y_continuous(breaks=c(7, 6, 5, 4, 3, 2, 1), labels=c("7" = "PPE", "6" = "Releasing vulnerable", "5" = "Releasing as many as possible", "4" = "Medical care for released", "3" = "Expedite deportations", "2" = "Detained too many", "1" = "General thoughts"))+ xlab("Effect size of health conditions treatment") + ylab("Outcome Variable") #Figure 4b in text figure4 ``` #Coefficient Plot by Racial Group #Figure 5b in text ```{r} ##Coefficient Plot with Different Samples and Estimators coeffs_race <- matrix(data = c(OLSw1$coeff[2], OLSw2$coeff[2], OLSw3$coeff[2], OLSw4$coeff[2], OLSw5$coeff[2], OLSb1$coeff[2], OLSb2$coeff[2], OLSb3$coeff[2], OLSb4$coeff[2], OLSb5$coeff[2], OLSL1$coeff[2], OLSL2$coeff[2], OLSL3$coeff[2], OLSL4$coeff[2], OLSL5$coeff[2]), byrow = TRUE, nrow =15) sample_race <- matrix(data = c("Sanitation", "Vulnerable Rel.", "Max. Releases", "Medical Care", "Exped. Deport.", "Sanitation", "Vulnerable Rel.", "Max. Releases", "Medical Care", "Exped. Deport.", "Sanitation", "Vulnerable Rel.", "Max. Releases", "Medical Care", "Exped. Deport."), byrow = TRUE, nrow = 15) estimator_race <- matrix(data = c("White", "White", "White", "White", "White", "Black", "Black", "Black", "Black", "Black", "Latinx", "Latinx", "Latinx", "Latinx", "Latinx"), byrow = TRUE, nrow = 15) conf.low.race <- matrix(data = c(confint(OLSw1)[2,1], confint(OLSw2)[2,1], confint(OLSw3)[2,1], confint(OLSw4)[2,1], confint(OLSw5)[2,1], confint(OLSb1)[2,1], confint(OLSb2)[2,1], confint(OLSb3)[2,1], confint(OLSb4)[2,1], confint(OLSb5)[2,1], confint(OLSL1)[2,1], confint(OLSL2)[2,1], confint(OLSL3)[2,1], confint(OLSL4)[2,1], confint(OLSL5)[2,1]), byrow = TRUE, nrow = 15) conf.high.race <- matrix(data = c(confint(OLSw1)[2,2], confint(OLSw2)[2,2], confint(OLSw3)[2,2], confint(OLSw4)[2,2], confint(OLSw5)[2,2], confint(OLSb1)[2,2], confint(OLSb2)[2,2], confint(OLSb3)[2,2], confint(OLSb4)[2,2], confint(OLSb5)[2,2], confint(OLSL1)[2,2], confint(OLSL2)[2,2], confint(OLSL3)[2,2], confint(OLSL4)[2,2], confint(OLSL5)[2,2]), byrow = TRUE, nrow = 15) df_figure_race <- data.frame(coeffs_race,sample_race, estimator_race, conf.low.race, conf.high.race) #Graph figure5_bw <- ggplot(df_figure_race, aes(y = coeffs_race, x = sample_race, colour = estimator_race)) + geom_hline(yintercept = 0, lwd = I(4/12), alpha = I(7/12), colour = "black") + geom_errorbar(aes(ymin = conf.low.race, ymax = conf.high.race), size = 1.25, width = 0, show.legend = FALSE, position = position_dodge(width = 0.5)) + geom_linerange(aes(ymin = conf.low.race, ymax = conf.high.race), size = 1.25, position = position_dodge(width = 0.5)) + geom_point(size = 3.5, position = position_dodge(width = 0.5)) + scale_shape_manual(values = c(16, 15)) + scale_color_manual(name = "Racial group of respondent", values = c("#060606", "#B4B5BD", "#48484B")) + theme_bw() + ylab("Effect of Health Conditions Treatment") + xlab("Policy Proposal") + theme(axis.text.x = element_text(angle = 15, hjust = .5, colour = "black"), axis.text.y = element_text(colour = "black")) #Figure 5b in text figure5_bw ``` ##Statistical references in main text ```{r} #Page 872: #In this survey, around half of respondents (49.5%) said that we ought to address COVID-19 in detention centers because it is a human rights issue. The other half indicated that immigrants in detention should not be a priority or should be a priority to protect American citizens. Thirty-eight percent said that we ought to address COVID-19 in detention centers to prevent spread to American citizens; 7.9% said that immigrant detainees should not be prioritized because they are not citizens; and 4.2% said that COVID-19 is a part of their punishment for coming to the United States without authorization. #See coding above in conversation to numerical scale for how numbers correspond to descriptions prop.table(table(dat_cleaned_noNAs$dengar_covid_dention)) ``` ```{r} #Page 874: #"Seventy percent of respondents strongly favored or favored providing increased sanitation supplies and PPE in detention centers..." prop.table(table(dat_cleaned_noNAs$dengar_deten_agr_1))[4] + prop.table(table(dat_cleaned_noNAs$dengar_deten_agr_1))[5] ``` ```{r} #Page 875: #"The mean 50% of respondents strongly favored or favored releasing vulnerable populations, and 35% strongly favored or favored releasing as many people as possible." #releasing vulnerable populations prop.table(table(dat_cleaned_noNAs$dengar_deten_agr_2))[4] + prop.table(table(dat_cleaned_noNAs$dengar_deten_agr_2))[5] #releasing as many as possible prop.table(table(dat_cleaned_noNAs$dengar_deten_agr_3))[4] + prop.table(table(dat_cleaned_noNAs$dengar_deten_agr_3))[5] #note: text says 35%, replication produces 36.8% ``` ```{r} #Page 875: #"Among respondents who said COVID-19 in detention centers is a human rights issue,75% strongly agreed with increasing sanitation supplies and personal protective equipment. For everyone else, only 35% of respondents strongly agreed with this proposal (see fig. 3)." #Including only those who believe it's human rights issue table1 <- table(dat_cleaned_noNAs$dengar_covid_dention, dat_cleaned_noNAs$dengar_deten_agr_1) table1_df <- as.data.frame(table1) new_tab1 <- data.table::setDT(table1_df)[, z := Freq/sum(Freq), by = Var2][20,4] #Excluding those who believe it's human rights issue filt_prop <- filter(dat_cleaned_noNAs, (dengar_covid_dention < 4)) prop.table(table(filt_prop$dengar_deten_agr_1)) ``` ##Appendix Figures #Table for descriptive statistics #Table 5 in appendix ```{r, echo=FALSE, results="asis", warning=FALSE, message=FALSE} library(xtable) weighted_dat_lat <- harvest(dat_cleaned_lat, target = target_pop, max_weight = 2.5) diagnose_dat_lat <- weighted_dat_lat %>% diagnose_weights() descriptive_table <- diagnose_dat_lat %>% select(variable, level, prop_original, prop_weighted, target) xtab_des <- descriptive_table %>% xtable(caption = "Descriptive Statistics", digits=c(0,0,3,3,3,3)) print.xtable(xtab_des, comment = FALSE, include.rownames = FALSE) ## Add Latinx category to Table 5 race and ethnicity category (comes from different column from original data, so imported separately) ## Latinx variable unweighted, so it matches across weighted and unweighted sample # Weighted prop.table(table(dat_cleaned_lat$lucid_ethnicity))[3] # Unweighted prop.table(table(dat$lucid_hispanic)) ``` #Scatterplots #Appendix Figures 17-22 ```{r} dat_cleaned_lat1 <- dat_cleaned_lat %>% filter(!is.na(lucid_ethnicity)) #Scatterplot of thoughts on COVID-19 in dentention centers summary_gen_thoughts <- dat_cleaned_lat1 %>% group_by(lucid_ethnicity) %>% do(tidy(lm_robust(dengar_covid_dention ~ 1, data = .))) %>% mutate(dengar_covid_dention = estimate) graph_gen_thoughts <- ggplot(summary_gen_thoughts, aes(x = lucid_ethnicity, y = dengar_covid_dention)) + geom_point( data = dat_cleaned_lat1, position = position_jitter(width = 0.2, height = 0.1), alpha = 0.05, color = 'darkblue' ) + theme_bw() + scale_y_continuous(breaks = c(0,1,2,3), labels = c("0" = "Part of Punishment", "1" = "Not priority, not American", "2"= "Address to protect Americans", "3" = "Human rights issue"), sec.axis = sec_axis(trans=~.*1, name="Mean Response")) + coord_cartesian(ylim = c(-0.1, 3.1))+ xlab("") + ylab("") + labs(title = "General thoughts on COVID-19 in migrant detention centers") + geom_point(size = 1) + geom_errorbar(aes(ymin = conf.low, ymax = conf.high), width = .025) + theme(plot.title = element_text(hjust=0.75)) #Appendix Figure 17 graph_gen_thoughts #Scatter Plot of Views on Increased Sanitation summary_sanitation <- dat_cleaned_lat1 %>% group_by(lucid_ethnicity) %>% do(tidy(lm_robust(dengar_deten_agr_1 ~ 1, data = .))) %>% mutate(dengar_deten_agr_1 = estimate) graph_sanitation <- ggplot(summary_sanitation, aes(x = lucid_ethnicity, y = dengar_deten_agr_1)) + geom_point( data = dat_cleaned_lat1, position = position_jitter(width = 0.2, height = 0.1), alpha = 0.05, color = 'darkblue' ) + theme_bw() + scale_y_continuous(breaks = c(0,1,2,3,4), labels = c("0" = "Strongly disagree", "1" = "Disagree", "2"= "Neither agree nor disagree", "3" = "Agree", "4" = "Strongly agree"), sec.axis = sec_axis(trans=~.*1, name="Mean Response")) + coord_cartesian(ylim = c(-0.1, 4.1))+ xlab("") + ylab("") + labs(title = "Support for Increased Sanitation and PPE in Detention Centers") + geom_point(size = 1) + geom_errorbar(aes(ymin = conf.low, ymax = conf.high), width = .025) + theme(plot.title = element_text(hjust=0.75)) #Appendix Figure 18 graph_sanitation #Scatter Plot of Views on Releasing Vulnerable summary_vulnerable <- dat_cleaned_lat1 %>% group_by(lucid_ethnicity) %>% do(tidy(lm_robust(dengar_deten_agr_2 ~ 1, data = .))) %>% mutate(dengar_deten_agr_2 = estimate) graph_vulnerable <- ggplot(summary_vulnerable, aes(x = lucid_ethnicity, y = dengar_deten_agr_2)) + geom_point( data = dat_cleaned_lat1, position = position_jitter(width = 0.2, height = 0.1), alpha = 0.05, color = 'darkblue' ) + theme_bw() + scale_y_continuous(breaks = c(0,1,2,3,4), labels = c("0" = "Strongly disagree", "1" = "Disagree", "2"= "Neither agree nor disagree", "3" = "Agree", "4" = "Strongly agree"), sec.axis = sec_axis(trans=~.*1, name="Mean Response")) + coord_cartesian(ylim = c(-0.1, 4.1))+ xlab("") + ylab("") + labs(title = "Support for Releasing Vulnerable Populations from Migrant Detention") + geom_point(size = 1) + geom_errorbar(aes(ymin = conf.low, ymax = conf.high), width = .025) + theme(plot.title = element_text(size = 11.5, hjust=0.75)) #Appendix Figure 19 graph_vulnerable #Support for Releasing as Many People as Possible summary_free_many <- dat_cleaned_lat1 %>% group_by(lucid_ethnicity) %>% do(tidy(lm_robust(dengar_deten_agr_3 ~ 1, data = .))) %>% mutate(dengar_deten_agr_3 = estimate) graph_free_many <- ggplot(summary_free_many, aes(x = lucid_ethnicity, y = dengar_deten_agr_3)) + geom_point( data = dat_cleaned_lat1, position = position_jitter(width = 0.2, height = 0.1), alpha = 0.05, color = 'darkblue' ) + theme_bw() + scale_y_continuous(breaks = c(0,1,2,3,4), labels = c("0" = "Strongly disagree", "1" = "Disagree", "2"= "Neither agree nor disagree", "3" = "Agree", "4" = "Strongly agree"), sec.axis = sec_axis(trans=~.*1, name="Mean Response")) + coord_cartesian(ylim = c(-0.1, 4.1))+ xlab("") + ylab("") + labs(title = "Support for Releasing as Many People as Possible from Migrant Detention") + geom_point(size = 1) + geom_errorbar(aes(ymin = conf.low, ymax = conf.high), width = .025) + theme(plot.title = element_text(size=11.5, hjust=.85)) #Appendix Figure 20 graph_free_many #Support for Providing Medical Care for People Released from Detention summary_medical <- dat_cleaned_lat1 %>% group_by(lucid_ethnicity) %>% do(tidy(lm_robust(dengar_deten_agr_4 ~ 1, data = .))) %>% mutate(dengar_deten_agr_4 = estimate) graph_medical <- ggplot(summary_medical, aes(x = lucid_ethnicity, y = dengar_deten_agr_4)) + geom_point( data = dat_cleaned_lat1, position = position_jitter(width = 0.2, height = 0.1), alpha = 0.05, color = 'darkblue' ) + theme_bw() + scale_y_continuous(breaks = c(0,1,2,3,4), labels = c("0" = "Strongly disagree", "1" = "Disagree", "2"= "Neither agree nor disagree", "3" = "Agree", "4" = "Strongly agree"), sec.axis = sec_axis(trans=~.*1, name="Mean Response")) + coord_cartesian(ylim = c(-0.1, 4.1))+ xlab("") + ylab("") + labs(title = "Support for Providing Medical Care for People Released from Detention") + geom_point(size = 1) + geom_errorbar(aes(ymin = conf.low, ymax = conf.high), width = .025) + theme(plot.title = element_text(size=12, hjust=0.85)) #Appendix Figure 21 graph_medical #Support for expediting deportations during the COVID-19 crisis summary_deportation <- dat_cleaned_lat1 %>% group_by(lucid_ethnicity) %>% do(tidy(lm_robust(dengar_deten_agr_5 ~ 1, data = .))) %>% mutate(dengar_deten_agr_5 = estimate) graph_deportation <- ggplot(summary_deportation, aes(x = lucid_ethnicity, y = dengar_deten_agr_5)) + geom_point( data = dat_cleaned_lat1, position = position_jitter(width = 0.2, height = 0.1), alpha = 0.05, color = 'darkblue' ) + theme_bw() + scale_y_continuous(breaks = c(0,1,2,3,4), labels = c("0" = "Strongly disagree", "1" = "Disagree", "2"= "Neither agree nor disagree", "3" = "Agree", "4" = "Strongly agree"), sec.axis = sec_axis(trans=~.*1, name="Mean Response")) + coord_cartesian(ylim = c(-0.1, 4.1))+ xlab("") + ylab("") + labs(title = "Suppot for expediting deportations during the COVID-19 crisis") + geom_point(size = 1) + geom_errorbar(aes(ymin = conf.low, ymax = conf.high), width = .025) + theme(plot.title = element_text(size=11, hjust=0.85)) #Appendix Figure 22 graph_deportation ``` #Coefficient plot for correlation between general views and policy preferences #Appendix Figure 25 ```{r} #Coefficient plot for correlation between general views and policy preferences coeffs.thought <- matrix(data = c(OLS_thought1$coeff[2], OLS_thought2$coeff[2], OLS_thought3$coeff[2], OLS_thought4$coeff[2], OLS_thought5$coeff[2])) conf.low.thought <- matrix(data = c(confint(OLS_thought1)[2,1], confint(OLS_thought2)[2,1], confint(OLS_thought3)[2,1], confint(OLS_thought4)[2,1], confint(OLS_thought5)[2,1])) conf.high.thought <- matrix(data = c(confint(OLS_thought1)[2,2], confint(OLS_thought2)[2,2], confint(OLS_thought3)[2,2], confint(OLS_thought4)[2,2], confint(OLS_thought5)[2,2])) treatment.thought <- matrix(data = c(5, 4, 3, 2, 1)) df_general_correlation <- data.frame(treatment.thought, coeffs.thought, conf.low.thought, conf.high.thought) general_correlation2 <- ggplot(df_general_correlation, aes(x = coeffs.thought, y = treatment.thought)) + geom_vline(xintercept = 0, lwd = I(4/12), alpha = I(7/12), colour = "maroon") + geom_errorbarh(aes(xmin = conf.low.thought, xmax = conf.high.thought), size = 1, width = 0, show.legend = FALSE, position = position_dodge(width = 0.5), colour = "navy") + geom_point(size = 2, position = position_dodge(width = 0.5), colour = "navy") + scale_shape_manual(values = c(16, 15)) + scale_color_manual(name = "", values = c("Navy")) + theme_bw() + theme(plot.title = element_text(hjust = .3, size = 12)) + scale_y_continuous(breaks=c(5, 4, 3, 2, 1), labels=c("5" = "Better sanitation and PPE", "4" = "Releasing vulnerable people during COVID", "3" = "Releasing as many people as possible during COVID", "2" = "Medical care for released", "1" = "Expediting deportations"))+ xlab("Coefficient size") + ylab("Policy preference") + labs(title = "Correlation betweeen general views on COVID-19 in detention and policy preferences") + theme(plot.title = element_text(size=10.7, hjust=0.98)) #Appendix Figure 25 general_correlation2 ``` #Regression figure for correlation between general views and policy preferences #Regression tables for experimental findings #Appendix Tables 16-22 ```{r} library(texreg) ``` ```{r} ##PPE + Sanitation #Table 16 in appendix #Normal OLS, without weights OLS1 <- lm_robust(dengar_deten_agr_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS1) #Normal OLS, with weights OLS1w <- lm_robust(dengar_deten_agr_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, weights = weights, data = dat_cleaned) summary(OLS1w) ##Without straightliners, without weights OLS1ws <- lm_robust(dengar_deten_agr_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned_straightliners_removed) summary(OLS1ws) ##Without straightliners, with weights OLS1wnos <- lm_robust(dengar_deten_agr_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, weights = weights, data = dat_cleaned_straightliners_removed) summary(OLS1wnos) ##Different covariates OLS1covs <- lm_robust(dengar_deten_agr_1 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age + lucid_region + lucid_hhi_numeric, data = dat_cleaned) summary(OLS1covs) ##Lin estimator lin1 <- lm_lin( dengar_deten_agr_1 ~ Z_dg, covariates = ~ lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned ) summary(lin1) texreg(list(OLS1, OLS1w, OLS1ws, OLS1wnos, OLS1covs, lin1), include.ci = FALSE, digits = 3) ``` ```{r} ##Releasing vulnerable #Table 17 in appendix #Normal OLS, without weights OLS2 <- lm_robust(dengar_deten_agr_2 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS2) #Normal OLS, with weights OLS2w <- lm_robust(dengar_deten_agr_2 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, weights = weights, data = dat_cleaned) summary(OLS2w) ##Without straightliners, without weights OLS2ws <- lm_robust(dengar_deten_agr_2 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned_straightliners_removed) summary(OLS2ws) ##Without straightliners, with weights OLS2wnos <- lm_robust(dengar_deten_agr_2 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, weights = weights, data = dat_cleaned_straightliners_removed) summary(OLS2wnos) ##Different covariates OLS2covs <- lm_robust(dengar_deten_agr_2 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age + lucid_region + lucid_hhi_numeric, data = dat_cleaned) summary(OLS2covs) ##Lin estimator lin2 <- lm_lin( dengar_deten_agr_2 ~ Z_dg, covariates = ~ lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned ) summary(lin2) texreg(list(OLS2, OLS2w, OLS2ws, OLS2wnos, OLS2covs, lin2), include.ci = FALSE, digits = 3) ``` ```{r} ##Releasing as many people as possible #Table 18 in appendix #Normal OLS, without weights OLS3 <- lm_robust(dengar_deten_agr_3 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS3) #Normal OLS, with weights OLS3w <- lm_robust(dengar_deten_agr_3 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, weights = weights, data = dat_cleaned) summary(OLS3w) ##Without straightliners, without weights OLS3ws <- lm_robust(dengar_deten_agr_3 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned_straightliners_removed) summary(OLS3ws) ##Without straightliners, with weights OLS3wnos <- lm_robust(dengar_deten_agr_3 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, weights = weights, data = dat_cleaned_straightliners_removed) summary(OLS3wnos) ##Different covariates OLS3covs <- lm_robust(dengar_deten_agr_3 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age + lucid_region + lucid_hhi_numeric, data = dat_cleaned) summary(OLS3covs) ##Lin estimator lin3 <- lm_lin( dengar_deten_agr_3 ~ Z_dg, covariates = ~ lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned ) summary(lin3) texreg(list(OLS3, OLS3w, OLS3ws, OLS3wnos, OLS3covs, lin3), include.ci = FALSE, digits = 3) ``` ```{r} ##Medical care #Table 19 in appendix #Normal OLS, without weights OLS4 <- lm_robust(dengar_deten_agr_4 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS4) #Normal OLS, with weights OLS4w <- lm_robust(dengar_deten_agr_4 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, weights = weights, data = dat_cleaned) summary(OLS4w) ##Without straightliners, without weights OLS4ws <- lm_robust(dengar_deten_agr_4 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned_straightliners_removed) summary(OLS4ws) ##Without straightliners, with weights OLS4wnos <- lm_robust(dengar_deten_agr_4 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, weights = weights, data = dat_cleaned_straightliners_removed) summary(OLS4wnos) ##Different covariates OLS4covs <- lm_robust(dengar_deten_agr_4 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age + lucid_region + lucid_hhi_numeric, data = dat_cleaned) summary(OLS4covs) ##Lin estimator lin4 <- lm_lin( dengar_deten_agr_4 ~ Z_dg, covariates = ~ lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned ) summary(lin4) texreg(list(OLS4, OLS4w, OLS4ws, OLS4wnos, OLS4covs, lin4), include.ci = FALSE, digits = 3) ``` ```{r} ##Expediting deportations #Table 20 in appendix #Normal OLS, without weights OLS5 <- lm_robust(dengar_deten_agr_5 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS5) #Normal OLS, with weights OLS5w <- lm_robust(dengar_deten_agr_5 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, weights = weights, data = dat_cleaned) summary(OLS5w) ##Without straightliners, without weights OLS5ws <- lm_robust(dengar_deten_agr_5 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned_straightliners_removed) summary(OLS5ws) ##Without straightliners, with weights OLS5wnos <- lm_robust(dengar_deten_agr_5 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, weights = weights, data = dat_cleaned_straightliners_removed) summary(OLS5wnos) ##Different covariates OLS5covs <- lm_robust(dengar_deten_agr_5 ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age + lucid_region + lucid_hhi_numeric, data = dat_cleaned) summary(OLS5covs) ##Lin estimator lin5 <- lm_lin( dengar_deten_agr_5 ~ Z_dg, covariates = ~ lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned ) summary(lin5) texreg(list(OLS5, OLS5w, OLS5ws, OLS5wnos, OLS5covs, lin5), include.ci = FALSE, digits = 3) ``` ```{r} ##General views #Table 21 in appendix #Normal OLS, without weights OLS6 <- lm_robust(dengar_covid_dention ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS6) #Normal OLS, with weights OLS6w <- lm_robust(dengar_covid_dention ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, weights = weights, data = dat_cleaned) summary(OLS6w) ##Without straightliners, without weights OLS6ws <- lm_robust(dengar_covid_dention ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned_straightliners_removed) summary(OLS6ws) ##Without straightliners, with weights OLS6wnos <- lm_robust(dengar_covid_dention ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, weights = weights, data = dat_cleaned_straightliners_removed) summary(OLS6wnos) ##Different covariates OLS6covs <- lm_robust(dengar_covid_dention ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age + lucid_region + lucid_hhi_numeric, data = dat_cleaned) summary(OLS6covs) ##Lin estimator lin6 <- lm_lin( dengar_covid_dention ~ Z_dg, covariates = ~ lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned ) summary(lin6) texreg(list(OLS6, OLS6w, OLS6ws, OLS6wnos, OLS6covs, lin6), include.ci = FALSE, digits = 3) ``` ```{r} ##Detained too much, about right, not enough #Table 22 in appendix #Normal OLS, without weights OLS7 <- lm_robust(dengar_detain_amount ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned) summary(OLS5) #Normal OLS, with weights OLS7w <- lm_robust(dengar_detain_amount ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, weights = weights, data = dat_cleaned) summary(OLS7w) ##Without straightliners, without weights OLS7ws <- lm_robust(dengar_detain_amount ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned_straightliners_removed) summary(OLS7ws) ##Without straightliners, with weights OLS7wnos <- lm_robust(dengar_detain_amount ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age, weights = weights, data = dat_cleaned_straightliners_removed) summary(OLS7wnos) ##Different covariates OLS7covs <- lm_robust(dengar_detain_amount ~ Z_dg + lucid_pid_7n + lucid_gender + lucid_age + lucid_region + lucid_hhi_numeric, data = dat_cleaned) summary(OLS7covs) ##Lin estimator lin7 <- lm_lin( dengar_detain_amount ~ Z_dg, covariates = ~ lucid_pid_7n + lucid_gender + lucid_age, data = dat_cleaned ) summary(lin7) texreg(list(OLS7, OLS7w, OLS7ws, OLS7wnos, OLS7covs, lin7), include.ci = FALSE, digits = 3) ```