File: 7AnimalProtectionandConsumerBehaviors_Spanish.R

Comment: ttests to compare composite 'animal protection behaviors' in people who have vs. have not experienced each (16 types total)
Category: Statistical Test
Code:
t.test(beh_animalprotect_comp ~ graphic_exp_buc, data=data, var.equal = TRUE) t.test(beh_animalprotect_comp~ nongraphic_exp_buc, data=data, var.equal = TRUE) t.test(beh_animalprotect_comp ~ person_exp_buc, data=data, var.equal = TRUE) t.test(beh_animalprotect_comp ~ leaflet_exp_buc, data=data, var.equal = TRUE) t.test(beh_animalprotect_comp ~ news_exp_buc, data=data, var.equal = TRUE) t.test(beh_animalprotect_comp ~ social_exp_buc, data=data, var.equal = TRUE) t.test(beh_animalprotect_comp ~ humaneed_exp_buc, data=data, var.equal = TRUE) t.test(beh_animalprotect_comp ~ documentary_exp_buc, data=data, var.equal = TRUE) t.test(beh_animalprotect_comp ~ book_exp_buc, data=data, var.equal = TRUE) t.test(beh_animalprotect_comp ~ celebrity_exp_buc, data=data, var.equal = TRUE) t.test(beh_animalprotect_comp ~ ad_exp_buc, data=data, var.equal = TRUE) t.test(beh_animalprotect_comp ~ challenge_exp_buc, data=data, var.equal = TRUE) t.test(beh_animalprotect_comp ~ labels_exp_buc, data=data, var.equal = TRUE) t.test(beh_animalprotect_comp~ labeled_exp_buc, data=data, var.equal = TRUE) t.test(beh_animalprotect_comp ~ ndisprotest_exp_buc, data=data, var.equal = TRUE) t.test(beh_animalprotect_comp ~ disprotest_exp_buc, data=data, var.equal = TRUE)

Comment: FDR correction for ttests that compared composite 'animal protection behaviors' between people who have and have not experienced each advocacy type
Category: Statistical Test
Code:
adjusted_pvalues_protectionbehaviors <- data %>% summarise(graphic_exp_buc = t.test(beh_animalprotect_comp ~ graphic_exp_buc, var.equal = TRUE)$p.value, nongraphic_exp_buc = t.test(beh_animalprotect_comp ~ nongraphic_exp_buc, var.equal = TRUE)$p.value, person_exp_buc = t.test(beh_animalprotect_comp ~ person_exp_buc, var.equal = TRUE)$p.value, leaflet_exp_buc = t.test(beh_animalprotect_comp ~ leaflet_exp_buc, var.equal = TRUE)$p.value, news_exp_buc = t.test(beh_animalprotect_comp ~ news_exp_buc, var.equal = TRUE)$p.value, social_exp_buc = t.test(beh_animalprotect_comp ~ social_exp_buc, var.equal = TRUE)$p.value, humaneed_exp_buc = t.test(beh_animalprotect_comp ~ humaneed_exp_buc, var.equal = TRUE)$p.value, documentary_exp_buc = t.test(beh_animalprotect_comp ~ documentary_exp_buc, var.equal = TRUE)$p.value, book_exp_buc = t.test(beh_animalprotect_comp ~ book_exp_buc, var.equal = TRUE)$p.value, celebrity_exp_buc = t.test(beh_animalprotect_comp ~ celebrity_exp_buc, var.equal = TRUE)$p.value, ad_exp_buc = t.test(beh_animalprotect_comp ~ ad_exp_buc, var.equal = TRUE)$p.value, challenge_exp_buc = t.test(beh_animalprotect_comp ~ challenge_exp_buc, var.equal = TRUE)$p.value, labels_exp_buc = t.test(beh_animalprotect_comp ~ labels_exp_buc, var.equal = TRUE)$p.value, labeled_exp_buc = t.test(beh_animalprotect_comp ~ labeled_exp_buc, var.equal = TRUE)$p.value, ndisprotest_exp_buc = t.test(beh_animalprotect_comp ~ ndisprotest_exp_buc, var.equal = TRUE)$p.value, disprotest_exp_buc = t.test(beh_animalprotect_comp ~ disprotest_exp_buc, var.equal = TRUE)$p.value) %>% gather("Advocacy","p_value") %>% mutate(p_fdr = p.adjust(p_value, method = "fdr", n = length(p_value))) %>% print()

Comment: ttests to compare composite 'animal consumer behaviors' in people who have vs. have not experienced each (16 types total)
Category: Statistical Test
Code:
t.test(beh_consumer_comp ~ graphic_exp_buc, data=data, var.equal = TRUE) t.test(beh_consumer_comp~ nongraphic_exp_buc, data=data, var.equal = TRUE) t.test(beh_consumer_comp ~ person_exp_buc, data=data, var.equal = TRUE) t.test(beh_consumer_comp ~ leaflet_exp_buc, data=data, var.equal = TRUE) t.test(beh_consumer_comp ~ news_exp_buc, data=data, var.equal = TRUE) t.test(beh_consumer_comp ~ social_exp_buc, data=data, var.equal = TRUE) t.test(beh_consumer_comp ~ humaneed_exp_buc, data=data, var.equal = TRUE) t.test(beh_consumer_comp ~ documentary_exp_buc, data=data, var.equal = TRUE) t.test(beh_consumer_comp ~ book_exp_buc, data=data, var.equal = TRUE) t.test(beh_consumer_comp ~ celebrity_exp_buc, data=data, var.equal = TRUE) t.test(beh_consumer_comp ~ ad_exp_buc, data=data, var.equal = TRUE) t.test(beh_consumer_comp ~ challenge_exp_buc, data=data, var.equal = TRUE) t.test(beh_consumer_comp ~ labels_exp_buc, data=data, var.equal = TRUE) t.test(beh_consumer_comp ~ labeled_exp_buc, data=data, var.equal = TRUE) t.test(beh_consumer_comp ~ ndisprotest_exp_buc, data=data, var.equal = TRUE) t.test(beh_consumer_comp ~ disprotest_exp_buc, data=data, var.equal = TRUE)

Comment: prepare animal protection behaviors for stacked graph
Category: Visualization
Code:
mean_CI_protect <- data %>% group_by(advocacytype, experienced) %>% summarize(n = n(), protect_mean = mean(beh_animalprotect_comp), protect_lci = t.test(beh_animalprotect_comp, conf.level = 0.95)$conf.int[1], protect_uci = t.test(beh_animalprotect_comp, conf.level = 0.95)$conf.int[2])

Comment: add asterisks to advocacy types that had sig different scores between experienced vs. not experienced from ttests
Category: Statistical Test
Code:
mean_CI_protect <- mean_CI_protect %>% mutate(advocacytype = case_when(advocacytype == "ad" ~ "Anuncio o Valla Publicitaria*", advocacytype == "book"  ~ "Libro*", advocacytype == "celebrity"  ~ "Celebridad*", advocacytype == "challenge"  ~ "Reto de Evitar la Carne*", advocacytype == "disprotest" ~ "Protesta Disruptiva*", advocacytype == "graphic"  ~ "Video GrÃ¡fico*", advocacytype == "humaneed"  ~ "EducaciÃ³n en el Aula de Clases*", advocacytype == "labeled"  ~ "InformaciÃ³n Educativa Sobre las Etiquetas de Bienestar*", advocacytype == "labels"  ~ "Etiquetas Vegano/De Base Vegetal*", advocacytype == "ndisprotest"  ~ "Protesta No Disruptiva*", advocacytype == "news" ~ "ArtÃ­culo de Noticias*", advocacytype == "nongraphic" ~ "Video No GrÃ¡fico*", advocacytype == "person" ~ "DivulgaciÃ³n Boca a Boca *", advocacytype == "social" ~"PublicaciÃ³n en Redes Sociales o en un Blog*", advocacytype == "documentary"  ~ "Documental*", advocacytype == "leaflet" ~ "Folleto o Volante*")) mean_CI_consume <- mean_CI_consume %>% mutate(advocacytype = case_when(advocacytype == "ad" ~ "Anuncio o Valla Publicitaria*", advocacytype == "book"  ~ "Libro*", advocacytype == "celebrity"  ~ "Celebridad*", advocacytype == "challenge"  ~ "Reto de Evitar la Carne*", advocacytype == "disprotest" ~ "Protesta Disruptiva*", advocacytype == "graphic"  ~ "Video GrÃ¡fico*", advocacytype == "humaneed"  ~ "EducaciÃ³n en el Aula de Clases*", advocacytype == "labeled"  ~ "InformaciÃ³n Educativa Sobre las Etiquetas de Bienestar*", advocacytype == "labels"  ~ "Etiquetas Vegano/De Base Vegetal*", advocacytype == "ndisprotest"  ~ "Protesta No Disruptiva*", advocacytype == "news" ~ "ArtÃ­culo de Noticias*", advocacytype == "nongraphic" ~ "Video No GrÃ¡fico*", advocacytype == "person" ~ "DivulgaciÃ³n Boca a Boca *", advocacytype == "social" ~"PublicaciÃ³n en Redes Sociales o en un Blog*", advocacytype == "documentary"  ~ "Documental*", advocacytype == "leaflet" ~ "Folleto o Volante*"))

Comment: factorize advocacy type for graph
Category: Data Variable
Code:
mean_CI_protect <- mean_CI_protect %>% mutate(advocacytype = factor(advocacytype, bar_order)) mean_CI_consume <- mean_CI_consume %>% mutate(advocacytype = factor(advocacytype, bar_order))

Comment: grouped bar graph for animal protection behaviors
Category: Visualization
Code:
ggplot(mean_CI_protect, aes(x= advocacytype, fill=experienced, y=protect_mean)) + geom_col(width = 0.8, position="dodge") + coord_flip(ylim=c(1,5)) + geom_errorbar(aes(x= advocacytype, ymin = protect_lci, ymax = protect_uci), width=0.4, colour = "black", position=position_dodge(.8)) + geom_text(aes(label = format(round(protect_mean, 1)), y = protect_uci), hjust = -0.2,# nudge_y = 2, size = 3, position = position_dodge(width = 1)) + labs(y= "PuntuaciÃ³n Media del Comportamiento de ProtecciÃ³n de los Animales", x = "Tipo de Defensa", caption = "Un asterisco (*) indica que hubo una diferencia estadÃ­sticamente significativa entre los grupos (todos los ps < 0,05) despuÃ©s de haber corregido mediante FDR. Para mÃ¡s detalles sobre cÃ³mo se llevaron a cabo estos anÃ¡lisis, vÃ©ase el Material Complementario.") + theme(legend.title = element_blank(), legend.position = "bottom", panel.background = element_rect("white"), panel.border = element_rect(fill = NA), panel.grid.major.x = element_line("grey")) + scale_fill_manual(values = c("Experimentado" = "#c47020", "No Experimentado" = "#F68D29"))