knitr::opts_chunk$set(warning =FALSE, message =FALSE) Mypackages <-c("lme4","tidyverse","effects","ggplot2","psych","MASS","Rmisc","lmerTest","ggthemes", "knitr","lsmeans","pastecs","sjstats","car","ordinal","Rcpp","corrplot", "ggpubr", "EnvStats","easyStats", "cowplot","see","datawizard", "ggcorrplot", "lavaan")#install.packages(Mypackages) #you must remove the # in this comment if you need to install the packages! lapply(Mypackages, require,character.only =TRUE)options(knitr.kable.NA ='—')set.seed(1)
Load Data
Code
# read in data filessetwd("~/Desktop")data_raw <-read.csv("/Users/zhouxinlu/Downloads/Phantom Rule Analysis/PILOT 1 Close Relationship Phantom Rules.csv")
Functions
Code
plot_cooker <-function(data, iv, dv) { part1 <-ggplot(data, aes(x = {{iv}}, y = {{dv}}, fill = {{iv}})) +geom_violin(alpha =0.3, scale ="count") +stat_summary(fun ="mean", geom ="point", size =3, color ="black") +stat_summary(fun.data = mean_cl_normal, geom ="errorbar", width =0.2,#change to make a data set from allEffects with mean, low CI, high CIsize =1.5, color ="black") +theme_classic() +xlab("") +ylab("")ggpar(part1, legend ="none")}pol_line <-function(data, iv, dv) {ggplot(data, aes(x = {{iv}}, y = {{dv}}, color = condition)) +stat_summary(fun.data ="mean_cl_normal", geom ="line") +geom_point(position =position_jitter(width =0.1, height =0.1), alpha =0.5) +labs(x ="Political Leaning", color ="Condition")}lizy_cooker <-function(dv, iv, Title, x_axis_labs, y_label, sample_size, coln, rown) { part1 <-ggviolin(gjg, x = dv, y = iv, color = dv,alpha =0.1, fill = dv, xlab ="Motive",trim =TRUE, ylab = y_label) +stat_summary(fun.data ="mean_cl_normal", geom ="crossbar", fatten =1) +scale_y_continuous(breaks =c(1:7)) +labs(title =paste0(Title, " (n = ", sample_size, ")")) +theme(panel.background =element_rect(fill ="transparent"), legend.position ="right", ## Consider “gray97” for fillplot.title =element_text(face ="bold", hjust =0.5, size =16), plot.subtitle =element_text(hjust =0.5),panel.grid.major.y =element_line(color='grey75'), axis.text.x =element_text(face ="plain", size =13, color ="black"),axis.text.y =element_text(face ="plain", size =13, color ="black"),axis.title.y =element_text(face ="plain", size =13, color ="black", margin =margin(t =0, r =10, b =0, l =0)), ## lower X axis titlepanel.border =element_rect(color ="black", fill =NA, size =1)) +scale_color_discrete(name ="Condition") +facet_wrap(~ vignette, ncol = coln, nrow = rown, scales ="free", as.table =TRUE)ggpar(part1, legend ="none")}#POL_gjg_long <- filter(gjg_long, political_overall %in% c("Democrat", "Republican"))#gjg_long$political_overall#ggplot(gjg_long, aes(x = condition, y = p_approve, color = condition)) +#geom_point(stat="summary", fun="mean", size = 2) +#facet_wrap(~political_overall) +#scale_x_discrete(labels = NULL)
Reshaping data
Demographics
Code
# fixing typodata_raw$close1_code <-gsub("Romatic partner", "Romantic partner", data_raw$close1_code)data_raw$close2_code <-gsub("Romatic partner", "Romantic partner", data_raw$close2_code)data_raw$close3_code <-gsub("Romatic partner", "Romantic partner", data_raw$close3_code)# making conservative, liberal, and moderate group data_raw <- data_raw %>%mutate(political_group =ifelse(Political_overall >4, "Conservative",ifelse(Political_overall <4, "Liberal", "Moderate")))# making a column for white vs non-whitedata_raw$White <-ifelse(grepl("White", data_raw$Race_Ethnicity_TEXT), "White", "Non-White")# making a column for URM vs non-URMurm_groups <-c("Black", "Hispanic or Latino/a/x", "American Indian and Native Alaskan", "Pacific Islander or Native Hawaiian", "Middle Eastern and North African")data_raw$URM <-ifelse(grepl(paste(urm_groups, collapse="|"), data_raw$Race_Ethnicity_TEXT), "URM", "Non-URM")# fixing jay_harmPdata_raw$jay_harmP <-as.numeric(data_raw$jay_harmP)data_raw$jay_harmP <- (data_raw$jay_harmP +100) /2
#### filtering people who failed the attn check ####data_raw$attn_self <-as.numeric(data_raw$attn_self)data <- data_raw %>%filter(attn_self >2)# Removing low quality datadata <- data %>%filter(!(prolificID %in%c("66574c6a2a79bcd8ac8a00e8", "662d15c45fc2c1ca89b362bf")))# changing numeric DVs to numericdata <- data %>%mutate_at(vars(loiter_interaction:jay_fair, Age), as.numeric)## median split on agedata <- data %>%mutate(age_split =ifelse(Age >median(Age, na.rm =TRUE), "above_median", "below_median"),age_median =median(Age, na.rm =TRUE))#### make dataset long ###data_long <- data %>%gather(stim, resp, "loiter_interaction":"jay_fair")data_long<-data_long %>%separate(stim, into=c("scenario", "DV"), sep="_")## shift dataset back to wide format ##data_long <-spread(data_long, DV, resp)# seperating the scenario order into their own columnsdata_long <- data_long %>%separate(scenario_order, into=c("first_scenario", "second_scenario", "third_scenario", "fourth_scenario", "fifth_scenario", "sixth_scenario"), sep="\\|")# renaming scenariosdata_long <- data_long %>%mutate(first_scenario =case_when( first_scenario =="FL_60"~"loiter", first_scenario =="FL_59"~"brights", first_scenario =="FL_57"~"jury", first_scenario =="FL_58"~"noise", first_scenario =="FL_56"~"music", first_scenario =="FL_55"~"jay",TRUE~ scenario))data_long <- data_long %>%mutate(second_scenario =case_when( second_scenario =="FL_60"~"loiter", second_scenario =="FL_59"~"brights", second_scenario =="FL_57"~"jury", second_scenario =="FL_58"~"noise", second_scenario =="FL_56"~"music", second_scenario =="FL_55"~"jay",TRUE~ scenario))data_long <- data_long %>%mutate(third_scenario =case_when( third_scenario =="FL_60"~"loiter", third_scenario =="FL_59"~"brights", third_scenario =="FL_57"~"jury", third_scenario =="FL_58"~"noise", third_scenario =="FL_56"~"music", third_scenario =="FL_55"~"jay",TRUE~ scenario))data_long <- data_long %>%mutate(fourth_scenario =case_when( fourth_scenario =="FL_60"~"loiter", fourth_scenario =="FL_59"~"brights", fourth_scenario =="FL_57"~"jury", fourth_scenario =="FL_58"~"noise", fourth_scenario =="FL_56"~"music", fourth_scenario =="FL_55"~"jay",TRUE~ scenario))data_long <- data_long %>%mutate(fifth_scenario =case_when( fifth_scenario =="FL_60"~"loiter", fifth_scenario =="FL_59"~"brights", fifth_scenario =="FL_57"~"jury", fifth_scenario =="FL_58"~"noise", fifth_scenario =="FL_56"~"music", fifth_scenario =="FL_55"~"jay",TRUE~ scenario))data_long <- data_long %>%mutate(sixth_scenario =case_when( sixth_scenario =="FL_60"~"loiter", sixth_scenario =="FL_59"~"brights", sixth_scenario =="FL_57"~"jury", sixth_scenario =="FL_58"~"noise", sixth_scenario =="FL_56"~"music", sixth_scenario =="FL_55"~"jay",TRUE~ scenario))# column for order the scenario was seendata_long <- data_long %>%mutate(presentation_order =case_when( scenario == first_scenario ~"first", scenario == second_scenario ~"second", scenario == third_scenario ~"third", scenario == fourth_scenario ~"fourth", scenario == fifth_scenario ~"fifth", scenario == sixth_scenario ~"sixth",TRUE~"not found" ))# column for whether the target was a stranger or close otherdata_long <- data_long %>%mutate(relationship =case_when( presentation_order =="first"& color_1 =="#FF5733"~"stranger", presentation_order =="first"& color_1 =="blue"~"close other", presentation_order =="second"& color_2 =="#FF5733"~"stranger", presentation_order =="second"& color_2 =="blue"~"close other", presentation_order =="third"& color_3 =="#FF5733"~"stranger", presentation_order =="third"& color_3 =="blue"~"close other", presentation_order =="fourth"& color_4 =="#FF5733"~"stranger", presentation_order =="fourth"& color_4 =="blue"~"close other", presentation_order =="fifth"& color_5 =="#FF5733"~"stranger", presentation_order =="fifth"& color_5 =="blue"~"close other", presentation_order =="sixth"& color_6 =="#FF5733"~"stranger", presentation_order =="sixth"& color_6 =="blue"~"close other",TRUE~"unknown" ))data_long <- data_long %>%mutate(corresponding_name =case_when( presentation_order =="first"~ name_1, presentation_order =="second"~ name_2, presentation_order =="third"~ name_3, presentation_order =="fourth"~ name_4, presentation_order =="fifth"~ name_5, presentation_order =="sixth"~ name_6,TRUE~NA_character_ ) )# Assign the appropriate relationship code or label as "stranger"data_long <- data_long %>%mutate(relationship_code =case_when( corresponding_name == close1_name ~ close1_code, corresponding_name == close2_name ~ close2_code, corresponding_name == close3_name ~ close3_code,TRUE~"stranger" ) )# column for how much participants like the close otherdata_long <- data_long %>%mutate(likeClose =case_when( corresponding_name == close1_name ~ likeClose1_1, corresponding_name == close2_name ~ likeClose2_1, corresponding_name == close3_name ~ likeClose3_1,TRUE~"n/a" ) )# making factor variables factorsdata_long <- data_long %>%mutate_at(vars(confront,didBreak,interaction, order,Gender), as.factor)
Individual Characteristics
Normative Alignment
Code
ggplot(data, aes(x = normComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Perceived Legitimacy of Law", x =" ", y ="Count") +theme_minimal()
By political group
Code
ggplot(data, aes(x = normComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Perceived Legitimacy of Law", x =" ", y ="Count") +theme_minimal() +facet_wrap("political_group")
By White
Code
ggplot(data, aes(x = normComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Perceived Legitimacy of Law", x =" ", y ="Count") +theme_minimal() +facet_wrap("White")
By URM
Code
ggplot(data, aes(x = normComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Perceived Legitimacy of Law", x =" ", y ="Count") +theme_minimal() +facet_wrap("URM")
By gender
Code
ggplot(data, aes(x = normComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Perceived Legitimacy of Law", x =" ", y ="Count") +theme_minimal() +facet_wrap("Gender_TEXT")
By age
Code
ggplot(data, aes(x = normComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Perceived Legitimacy of Law", x =" ", y ="Count") +theme_minimal() +facet_wrap("age_split")
Social Dominance Orientation
Code
ggplot(data, aes(x = SDOcomp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Social Dominance Orientation", x =" ", y ="Count") +theme_minimal()
By political Group
Code
ggplot(data, aes(x = SDOcomp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Social Dominance Orientation", x =" ", y ="Count") +theme_minimal() +facet_wrap("political_group")
By White
Code
ggplot(data, aes(x = SDOcomp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Social Dominance Orientation", x =" ", y ="Count") +theme_minimal() +facet_wrap("White")
By URM
Code
ggplot(data, aes(x = SDOcomp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Social Dominance Orientation", x =" ", y ="Count") +theme_minimal() +facet_wrap("URM")
By gender
Code
ggplot(data, aes(x = SDOcomp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Social Dominance Orientation", x =" ", y ="Count") +theme_minimal() +facet_wrap("Gender_TEXT")
By age
Code
ggplot(data, aes(x = SDOcomp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Social Dominance Orientation", x =" ", y ="Count") +theme_minimal() +facet_wrap("age_split")
Belief in a Just World
Code
ggplot(data, aes(x = bjwComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Belief in a Just World", x =" ", y ="Count") +theme_minimal()
By political Group
Code
ggplot(data, aes(x = bjwComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Belief in a Just World", x =" ", y ="Count") +theme_minimal() +facet_wrap("political_group")
By White
Code
ggplot(data, aes(x = bjwComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Belief in a Just World", x =" ", y ="Count") +theme_minimal() +facet_wrap("White")
By URM
Code
ggplot(data, aes(x = bjwComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Belief in a Just World", x =" ", y ="Count") +theme_minimal() +facet_wrap("URM")
By gender
Code
ggplot(data, aes(x = bjwComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Belief in a Just World", x =" ", y ="Count") +theme_minimal() +facet_wrap("Gender_TEXT")
By age
Code
ggplot(data, aes(x = bjwComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Belief in a Just World", x =" ", y ="Count") +theme_minimal() +facet_wrap("age_split")
Right Wing Authoritarianism
Code
ggplot(data, aes(x = RWAComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Right Wing Authoritarianism", x =" ", y ="Count") +theme_minimal()
By political Group
Code
ggplot(data, aes(x = RWAComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Right Wing Authoritarianism", x =" ", y ="Count") +theme_minimal() +facet_wrap("political_group")
By White
Code
ggplot(data, aes(x = RWAComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Right Wing Authoritarianism", x =" ", y ="Count") +theme_minimal() +facet_wrap("White")
By URM
Code
ggplot(data, aes(x = RWAComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Right Wing Authoritarianism", x =" ", y ="Count") +theme_minimal() +facet_wrap("URM")
By gender
Code
ggplot(data, aes(x = RWAComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Right Wing Authoritarianism", x =" ", y ="Count") +theme_minimal() +facet_wrap("Gender_TEXT")
By age
Code
ggplot(data, aes(x = RWAComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Right Wing Authoritarianism", x =" ", y ="Count") +theme_minimal() +facet_wrap("age_split")
contingency_table <-table(data_long$relationship, data_long$interaction)# Print the contingency table to see the countsprint(contingency_table)
0 1
close other 222 222
stranger 214 230
Code
# Perform the chi-square testchisq.test(contingency_table)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table
X-squared = 0.22079, df = 1, p-value = 0.6384
Code
stranger_data <- data_long %>%filter(relationship =="stranger")contingency_table <-table(stranger_data$relationship, stranger_data$interaction)# Print the contingency table to see the countsprint(contingency_table)
0 1
stranger 214 230
Code
# Perform the chi-square testchisq.test(contingency_table)
Chi-squared test for given probabilities
data: contingency_table
X-squared = 0.57658, df = 1, p-value = 0.4477
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_noise
X-squared = 0.0035298, df = 1, p-value = 0.9526
Would you prefer to confront the person yourself, or have a police officer confront them?
Main plot
Code
confront_plot <-ggplot(data_long, aes(x=relationship, fill=confront)) +geom_bar(position="dodge") +labs(x="relationship", y="Count", fill="1=Confront them myself, 2=Have a police officer confront them", title ="Would you prefer to confront the person yourself, or have a police officer confront them?") +theme_minimal()print(confront_plot)
Statistical testing
Code
contingency_table <-table(data_long$relationship, data_long$confront)# Print the contingency table to see the countsprint(contingency_table)
1 2
close other 265 179
stranger 254 190
Code
# Perform the chi-square testchisq.test(contingency_table)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table
X-squared = 0.46368, df = 1, p-value = 0.4959
Plot for each scenario
Code
confront_plot <-ggplot(data_long, aes(x=relationship, fill=confront)) +geom_bar(position="dodge") +labs(x="relationship", y="Count", fill="1=Yes, 0=No", title ="Would you prefer to confront the person yourself, or have a police officer confront them?") +theme_minimal() +facet_wrap("scenario")print(confront_plot)
Statistical testing
Code
contingency_table_jay <-table(jay_data$relationship, jay_data$confront)contingency_table_brights <-table(brights_data$relationship, brights_data$confront)contingency_table_jury <-table(jury_data$relationship, jury_data$confront)contingency_table_loiter <-table(loiter_data$relationship, loiter_data$confront)contingency_table_music <-table(music_data$relationship, music_data$confront)contingency_table_noise <-table(noise_data$relationship, noise_data$confront)# Print the contingency table to see the countsprint(contingency_table_jay)
1 2
close other 37 35
stranger 40 36
Code
print(contingency_table_brights)
1 2
close other 44 34
stranger 40 30
Code
print(contingency_table_jury)
1 2
close other 45 26
stranger 40 37
Code
print(contingency_table_loiter)
1 2
close other 52 26
stranger 42 28
Code
print(contingency_table_music)
1 2
close other 53 21
stranger 51 23
Code
print(contingency_table_noise)
1 2
close other 34 37
stranger 41 36
Code
# Perform the chi-square testchisq.test(contingency_table_jay)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_jay
X-squared = 0, df = 1, p-value = 1
Code
chisq.test(contingency_table_brights)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_brights
X-squared = 9.77e-31, df = 1, p-value = 1
Code
chisq.test(contingency_table_jury)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_jury
X-squared = 1.5348, df = 1, p-value = 0.2154
Code
chisq.test(contingency_table_loiter)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_loiter
X-squared = 0.4491, df = 1, p-value = 0.5028
Code
chisq.test(contingency_table_music)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_music
X-squared = 0.032343, df = 1, p-value = 0.8573
Code
chisq.test(contingency_table_noise)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_noise
X-squared = 0.23715, df = 1, p-value = 0.6263
Did this person break the rule?
Main plot
Code
didBreak_plot <-ggplot(data_long, aes(x=relationship, fill=didBreak)) +geom_bar(position="dodge") +labs(x="relationship", y="Count", fill="1=Yes, 0=No", title ="Did this person break the rule?") +theme_minimal()print(didBreak_plot)
Statistical testing
Code
contingency_table <-table(data_long$relationship, data_long$didBreak)# Print the contingency table to see the countsprint(contingency_table)
0 1
close other 53 391
stranger 47 397
Code
# Perform the chi-square testchisq.test(contingency_table)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table
X-squared = 0.28173, df = 1, p-value = 0.5956
Plot for each scenario
Code
didBreak_plot <-ggplot(data_long, aes(x=relationship, fill=didBreak)) +geom_bar(position="dodge") +labs(x="relationship", y="Count", fill="1=Yes, 0=No", title ="Did this person break the rule?") +theme_minimal() +facet_wrap("scenario")print(didBreak_plot)
Statistical testing
Code
contingency_table_jay <-table(jay_data$relationship, jay_data$didBreak)contingency_table_brights <-table(brights_data$relationship, brights_data$didBreak)contingency_table_jury <-table(jury_data$relationship, jury_data$didBreak)contingency_table_loiter <-table(loiter_data$relationship, loiter_data$didBreak)contingency_table_music <-table(music_data$relationship, music_data$didBreak)contingency_table_noise <-table(noise_data$relationship, noise_data$didBreak)# Print the contingency table to see the countsprint(contingency_table_jay)
0 1
close other 8 64
stranger 13 63
Code
print(contingency_table_brights)
0 1
close other 11 67
stranger 9 61
Code
print(contingency_table_jury)
0 1
close other 8 63
stranger 9 68
Code
print(contingency_table_loiter)
0 1
close other 17 61
stranger 9 61
Code
print(contingency_table_music)
0 1
close other 7 67
stranger 3 71
Code
print(contingency_table_noise)
0 1
close other 2 69
stranger 4 73
Code
# Perform the chi-square testchisq.test(contingency_table_jay)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_jay
X-squared = 0.65427, df = 1, p-value = 0.4186
Code
chisq.test(contingency_table_brights)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_brights
X-squared = 1.0961e-29, df = 1, p-value = 1
Code
chisq.test(contingency_table_jury)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_jury
X-squared = 7.4368e-31, df = 1, p-value = 1
Code
chisq.test(contingency_table_loiter)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_loiter
X-squared = 1.4647, df = 1, p-value = 0.2262
Code
chisq.test(contingency_table_music)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_music
X-squared = 0.96522, df = 1, p-value = 0.3259
Code
chisq.test(contingency_table_noise)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_noise
X-squared = 0.099644, df = 1, p-value = 0.7523
Does punishing people who break the rule help maintain order?
Main plot
Code
order_plot <-ggplot(data_long, aes(x=relationship, fill=order)) +geom_bar(position="dodge") +labs(x="relationship", y="Count", fill="1=Yes, 0=No", title ="Does punishing people who break the rule help maintain order?") +theme_minimal()print(order_plot)
Statistical testing
Code
contingency_table <-table(data_long$relationship, data_long$order)# Print the contingency table to see the countsprint(contingency_table)
0 1
close other 197 247
stranger 206 238
Code
# Perform the chi-square testchisq.test(contingency_table)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table
X-squared = 0.29077, df = 1, p-value = 0.5897
Plot for each scenario
jaywalking significant
Code
order_plot <-ggplot(data_long, aes(x=relationship, fill=order)) +geom_bar(position="dodge") +labs(x="relationship", y="Count", fill="1=Yes, 0=No", title ="Does punishing people who break the rule help maintain order?") +theme_minimal() +facet_wrap("scenario")print(order_plot)
Statistical testing
Code
contingency_table_jay <-table(jay_data$relationship, jay_data$order)contingency_table_brights <-table(brights_data$relationship, brights_data$order)contingency_table_jury <-table(jury_data$relationship, jury_data$order)contingency_table_loiter <-table(loiter_data$relationship, loiter_data$order)contingency_table_music <-table(music_data$relationship, music_data$order)contingency_table_noise <-table(noise_data$relationship, noise_data$order)# Print the contingency table to see the countsprint(contingency_table_jay)
0 1
close other 25 47
stranger 46 30
Code
print(contingency_table_brights)
0 1
close other 30 48
stranger 23 47
Code
print(contingency_table_jury)
0 1
close other 40 31
stranger 40 37
Code
print(contingency_table_loiter)
0 1
close other 44 34
stranger 42 28
Code
print(contingency_table_music)
0 1
close other 48 26
stranger 43 31
Code
print(contingency_table_noise)
0 1
close other 10 61
stranger 12 65
Code
# Perform the chi-square testchisq.test(contingency_table_jay)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_jay
X-squared = 8.8568, df = 1, p-value = 0.00292
Code
chisq.test(contingency_table_brights)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_brights
X-squared = 0.28976, df = 1, p-value = 0.5904
Code
chisq.test(contingency_table_jury)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_jury
X-squared = 0.13713, df = 1, p-value = 0.7112
Code
chisq.test(contingency_table_loiter)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_loiter
X-squared = 0.075666, df = 1, p-value = 0.7833
Code
chisq.test(contingency_table_music)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_music
X-squared = 0.45653, df = 1, p-value = 0.4993
Code
chisq.test(contingency_table_noise)
Pearson's Chi-squared test with Yates' continuity correction
data: contingency_table_noise
X-squared = 0.00062503, df = 1, p-value = 0.9801
Would you want to anonymously report this person?
Main plot + distribution
Code
anonReport_plot <-ggplot(data_long, aes(x = relationship, y = anonReport)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = anonReport), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood they would report", title ="Would you want to anonymously report this person?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(anonReport_plot)
Main plot + distribution for each scenario
Code
anonReport_plot <-ggplot(data_long, aes(x = relationship, y = anonReport)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = anonReport), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood they would report", title ="Would you want to anonymously report this person?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(anonReport_plot)
Would you want to publicly report this person?
Main plot + distribution
Code
publicReport_plot <-ggplot(data_long, aes(x = relationship, y = publicReport)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = publicReport), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood they would report", title ="Would you want to publicly report this person?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(publicReport_plot)
Main plot + distribution for each scenario
Code
publicReport_plot <-ggplot(data_long, aes(x = relationship, y = publicReport)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = publicReport), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood they would report", title ="Would you want to publicly report this person?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(publicReport_plot)
Do you want this person to know that you reported him/her?
Main plot + distribution
Code
knowReport_plot <-ggplot(data_long, aes(x = relationship, y = knowReport)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = knowReport), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood they want to be known it was them", title ="Do you want this person to know that you reported him/her?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =20),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =15, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(knowReport_plot)
Main plot + distribution for each scenario
Code
knowReport_plot <-ggplot(data_long, aes(x = relationship, y = knowReport)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = knowReport), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood they want to be known it was them", title ="Do you want this person to know that you reported him/her?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =20),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =15, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(knowReport_plot)
How punishable is the act?
Main plot + distribution
Code
punish_plot <-ggplot(data_long, aes(x = relationship, y = punish)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = punish), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="How punishable they would report", title ="How punishable is the act?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =35),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(punish_plot)
Main plot + distribution for each scenario
Code
punish_plot <-ggplot(data_long, aes(x = relationship, y = punish)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = punish), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="How punishable they would report", title ="How punishable is the act?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =35),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(punish_plot)
How morally bad is the act?
Main plot + distribution
Code
moral_plot <-ggplot(data_long, aes(x = relationship, y = moral)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = moral), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="How morally bad they would report", title ="How morally bad is the act?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =35),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(moral_plot)
Main plot + distribution for each scenario
Code
moral_plot <-ggplot(data_long, aes(x = relationship, y = moral)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = moral), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="How morally bad they would report", title ="How morally bad is the act?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =35),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(moral_plot)
How justified is it for the legal system to be involved when a person violate a speficit phantom rule?
Main plot + distribution
Code
justified_plot <-ggplot(data_long, aes(x = relationship, y = justified)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = justified), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Justified level", title ="How justified is it for the legal system to be involved when a person violate the rule?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =15),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(justified_plot)
Main plot + distribution for each scenario
Code
justified_plot <-ggplot(data_long, aes(x = relationship, y = justified)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = justified), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Justified level", title ="How justified is it for the legal system to be involved when a person violate the rule?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =15),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(justified_plot)
How legitimate is the law against the rule?
Main plot + distribution
Code
legit_plot <-ggplot(data_long, aes(x = relationship, y = legit)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = legit), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Legitimate level", title ="How legitimate is the law against the rule?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =30),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(legit_plot)
Main plot + distribution for each scenario
Code
legit_plot <-ggplot(data_long, aes(x = relationship, y = legit)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = legit), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Legitimate level", title ="How legitimate is the law against the rule?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =30),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(legit_plot)
How fair is the law against the violation of the phantom rule?
Main plot + distribution
Code
fair_plot <-ggplot(data_long, aes(x = relationship, y = fair)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = fair), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Fair level", title ="How fair is the law on the phantom rule?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =35),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(fair_plot)
Main plot + distribution for each scenario
Code
fair_plot <-ggplot(data_long, aes(x = relationship, y = fair)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = fair), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Fair level", title ="How fair is the law on the phantom rule?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =35),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(fair_plot)
How likely is it that this person will break rules in the future?
Main plot + distribution
Code
breakP_plot <-ggplot(data_long, aes(x = relationship, y = breakP)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = breakP), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood to break rule", title ="How likely is it that this person will break rules in the future?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =20),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(breakP_plot)
Main plot + distribution for each scenario
Code
breakP_plot <-ggplot(data_long, aes(x = relationship, y = breakP)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = breakP), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood to break rule", title ="How likely is it that this person will break rules in the future?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =20),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(breakP_plot)
How much do you feel the actions of this person were harmful to others?
Main plot + distribution
Code
harmP_plot <-ggplot(data_long, aes(x = relationship, y = harmP)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = harmP), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Level of harmfulness", title ="How much do you feel the actions of this person were harmful to others?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =20),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(harmP_plot)
Main plot + distribution for each scenario
Code
harmP_plot <-ggplot(data_long, aes(x = relationship, y = harmP)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = harmP), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Level of harmfulness", title ="How much do you feel the actions of this person were harmful to others?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =20),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(harmP_plot)
Should the legal system consider getting rid of the law prohibiting the phantom rule?
Main plot + distribution
Code
remove_plot <-ggplot(data_long, aes(x = relationship, y = remove)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = remove), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="How much they would agree or disagree with the statement", title ="The legal system should consider getting rid of the law prohibiting the phantom rule.") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =17),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =15, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(-100, 100)) +scale_y_continuous(breaks =c(-100, -50, 0, 50, 100)) #-100-100: -100, -50, 0, 50, 100print(remove_plot)
Main plot + distribution for each scenario
Code
remove_plot <-ggplot(data_long, aes(x = relationship, y = remove)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = remove), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="How much they would agree or disagree with the statement", title ="The legal system should consider getting rid of the law prohibiting the phantom rule.") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =17),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =15, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(-100, 100)) +scale_y_continuous(breaks =c(-100, -50, 0, 50, 100)) #-100-100: -100, -50, 0, 50, 100print(remove_plot)
Assuming this person did break the rule, how would you rate their moral character?
Main plot + distribution
Code
moralP_plot <-ggplot(data_long, aes(x = relationship, y = moralP)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = moralP), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Rating of moral character", title ="Assuming this person did break the rule, how would you rate their moral character?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =17),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(-100, 100)) +scale_y_continuous(breaks =c(-100, -50, 0, 50, 100)) #-100-100: -100, -50, 0, 50, 100print(moralP_plot)
Main plot + distribution for each scenario
Code
moralP_plot <-ggplot(data_long, aes(x = relationship, y = moralP)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = moralP), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Rating of moral character", title ="Assuming this person did break the rule, how would you rate their moral character?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =17),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(-100, 100)) +scale_y_continuous(breaks =c(-100, -50, 0, 50, 100)) #-100-100: -100, -50, 0, 50, 100print(moralP_plot)
Source Code
---title: "Phantom Rule Pilot 1"author: 'Marcus, Amanda'date: "7/23/2024"format: html: code-fold: true code-tools: true fontsize: 16px self-contained: true toc: true toc-location: leftoutput: html_document: code_folding: hide number_sections: true toc: true toc_float: true toc_collapsed: true toc_depth: 3 keep_md: yes header-includes: - \usepackage{Roboto Condensed}knitr: opts_chunk: dev: ragg_pngexecute: warning: false---# Setup {.tabset .tabset-pills}## Libraries {.unlisted .unnumbered}```{r setup, message=F, results='hide', warning=FALSE}knitr::opts_chunk$set(warning =FALSE, message =FALSE) Mypackages <-c("lme4","tidyverse","effects","ggplot2","psych","MASS","Rmisc","lmerTest","ggthemes", "knitr","lsmeans","pastecs","sjstats","car","ordinal","Rcpp","corrplot", "ggpubr", "EnvStats","easyStats", "cowplot","see","datawizard", "ggcorrplot", "lavaan")#install.packages(Mypackages) #you must remove the # in this comment if you need to install the packages! lapply(Mypackages, require,character.only =TRUE)options(knitr.kable.NA ='—')set.seed(1) ```## Load Data```{r, message=F, results='hide', warning=FALSE}# read in data filessetwd("~/Desktop")data_raw <-read.csv("/Users/zhouxinlu/Downloads/Phantom Rule Analysis/PILOT 1 Close Relationship Phantom Rules.csv")```## Functions```{r, message=F, results='hide', warning=FALSE}plot_cooker <-function(data, iv, dv) { part1 <-ggplot(data, aes(x = {{iv}}, y = {{dv}}, fill = {{iv}})) +geom_violin(alpha =0.3, scale ="count") +stat_summary(fun ="mean", geom ="point", size =3, color ="black") +stat_summary(fun.data = mean_cl_normal, geom ="errorbar", width =0.2,#change to make a data set from allEffects with mean, low CI, high CIsize =1.5, color ="black") +theme_classic() +xlab("") +ylab("")ggpar(part1, legend ="none")}pol_line <-function(data, iv, dv) {ggplot(data, aes(x = {{iv}}, y = {{dv}}, color = condition)) +stat_summary(fun.data ="mean_cl_normal", geom ="line") +geom_point(position =position_jitter(width =0.1, height =0.1), alpha =0.5) +labs(x ="Political Leaning", color ="Condition")}lizy_cooker <-function(dv, iv, Title, x_axis_labs, y_label, sample_size, coln, rown) { part1 <-ggviolin(gjg, x = dv, y = iv, color = dv,alpha =0.1, fill = dv, xlab ="Motive",trim =TRUE, ylab = y_label) +stat_summary(fun.data ="mean_cl_normal", geom ="crossbar", fatten =1) +scale_y_continuous(breaks =c(1:7)) +labs(title =paste0(Title, " (n = ", sample_size, ")")) +theme(panel.background =element_rect(fill ="transparent"), legend.position ="right", ## Consider “gray97” for fillplot.title =element_text(face ="bold", hjust =0.5, size =16), plot.subtitle =element_text(hjust =0.5),panel.grid.major.y =element_line(color='grey75'), axis.text.x =element_text(face ="plain", size =13, color ="black"),axis.text.y =element_text(face ="plain", size =13, color ="black"),axis.title.y =element_text(face ="plain", size =13, color ="black", margin =margin(t =0, r =10, b =0, l =0)), ## lower X axis titlepanel.border =element_rect(color ="black", fill =NA, size =1)) +scale_color_discrete(name ="Condition") +facet_wrap(~ vignette, ncol = coln, nrow = rown, scales ="free", as.table =TRUE)ggpar(part1, legend ="none")}#POL_gjg_long <- filter(gjg_long, political_overall %in% c("Democrat", "Republican"))#gjg_long$political_overall#ggplot(gjg_long, aes(x = condition, y = p_approve, color = condition)) +#geom_point(stat="summary", fun="mean", size = 2) +#facet_wrap(~political_overall) +#scale_x_discrete(labels = NULL)```# Reshaping data## Demographics```{r}# fixing typodata_raw$close1_code <-gsub("Romatic partner", "Romantic partner", data_raw$close1_code)data_raw$close2_code <-gsub("Romatic partner", "Romantic partner", data_raw$close2_code)data_raw$close3_code <-gsub("Romatic partner", "Romantic partner", data_raw$close3_code)# making conservative, liberal, and moderate group data_raw <- data_raw %>%mutate(political_group =ifelse(Political_overall >4, "Conservative",ifelse(Political_overall <4, "Liberal", "Moderate")))# making a column for white vs non-whitedata_raw$White <-ifelse(grepl("White", data_raw$Race_Ethnicity_TEXT), "White", "Non-White")# making a column for URM vs non-URMurm_groups <-c("Black", "Hispanic or Latino/a/x", "American Indian and Native Alaskan", "Pacific Islander or Native Hawaiian", "Middle Eastern and North African")data_raw$URM <-ifelse(grepl(paste(urm_groups, collapse="|"), data_raw$Race_Ethnicity_TEXT), "URM", "Non-URM")# fixing jay_harmPdata_raw$jay_harmP <-as.numeric(data_raw$jay_harmP)data_raw$jay_harmP <- (data_raw$jay_harmP +100) /2```## Individual Characteristics```{r}# making the individual characteristics numericdata_raw <- data_raw %>%mutate(across(c(legitO_1, legitO_2, legitO_3, legitO_4, SDO_1, SDO_2, SDO_3, SDO_4, bjw_1, bjw_2, bjw_3, bjw_4, RWA_1R, RWA_2, RWA_3, RWA_4R, RWA_5R, RWA_6), as.numeric))## transforming the reverse coded RWA values data_raw$RWA_1 <-8- data_raw$RWA_1Rdata_raw$RWA_4 <-8- data_raw$RWA_4Rdata_raw$RWA_5 <-8- data_raw$RWA_5R## making composite variables for individual characteristicsdata_raw <- data_raw %>%mutate(normComp =rowMeans(dplyr::select(., legitO_1, legitO_2, legitO_3, legitO_4), na.rm =TRUE))data_raw <- data_raw %>%mutate(SDOcomp =rowMeans(dplyr::select(., SDO_1, SDO_2, SDO_3, SDO_4), na.rm =TRUE))data_raw <- data_raw %>%mutate(bjwComp =rowMeans(dplyr::select(., bjw_1, bjw_2, bjw_3, bjw_4), na.rm =TRUE))data_raw <- data_raw %>%mutate(RWAComp =rowMeans(dplyr::select(., RWA_1, RWA_2, RWA_3, RWA_4, RWA_5, RWA_6), na.rm =TRUE))# Calculating and creating median splitsdata_raw <- data_raw %>%mutate(normComp_split =ifelse(normComp >median(normComp, na.rm =TRUE), "above_median", "below_median"),normComp_median =median(normComp, na.rm =TRUE))data_raw <- data_raw %>%mutate(SDOcomp_split =ifelse(SDOcomp >median(SDOcomp, na.rm =TRUE), "above_median", "below_median"),SDOcomp_median =median(SDOcomp, na.rm =TRUE))data_raw <- data_raw %>%mutate(bjwComp_split =ifelse(bjwComp >median(bjwComp, na.rm =TRUE), "above_median", "below_median"),bjwComp_median =median(bjwComp, na.rm =TRUE))data_raw <- data_raw %>%mutate(RWAComp_split =ifelse(RWAComp >median(RWAComp, na.rm =TRUE), "above_median", "below_median"),RWAComp_median =median(RWAComp, na.rm =TRUE))```## Rest of data```{r}#### filtering people who failed the attn check ####data_raw$attn_self <-as.numeric(data_raw$attn_self)data <- data_raw %>%filter(attn_self >2)# Removing low quality datadata <- data %>%filter(!(prolificID %in%c("66574c6a2a79bcd8ac8a00e8", "662d15c45fc2c1ca89b362bf")))# changing numeric DVs to numericdata <- data %>%mutate_at(vars(loiter_interaction:jay_fair, Age), as.numeric)## median split on agedata <- data %>%mutate(age_split =ifelse(Age >median(Age, na.rm =TRUE), "above_median", "below_median"),age_median =median(Age, na.rm =TRUE))#### make dataset long ###data_long <- data %>%gather(stim, resp, "loiter_interaction":"jay_fair")data_long<-data_long %>%separate(stim, into=c("scenario", "DV"), sep="_")## shift dataset back to wide format ##data_long <-spread(data_long, DV, resp)# seperating the scenario order into their own columnsdata_long <- data_long %>%separate(scenario_order, into=c("first_scenario", "second_scenario", "third_scenario", "fourth_scenario", "fifth_scenario", "sixth_scenario"), sep="\\|")# renaming scenariosdata_long <- data_long %>%mutate(first_scenario =case_when( first_scenario =="FL_60"~"loiter", first_scenario =="FL_59"~"brights", first_scenario =="FL_57"~"jury", first_scenario =="FL_58"~"noise", first_scenario =="FL_56"~"music", first_scenario =="FL_55"~"jay",TRUE~ scenario))data_long <- data_long %>%mutate(second_scenario =case_when( second_scenario =="FL_60"~"loiter", second_scenario =="FL_59"~"brights", second_scenario =="FL_57"~"jury", second_scenario =="FL_58"~"noise", second_scenario =="FL_56"~"music", second_scenario =="FL_55"~"jay",TRUE~ scenario))data_long <- data_long %>%mutate(third_scenario =case_when( third_scenario =="FL_60"~"loiter", third_scenario =="FL_59"~"brights", third_scenario =="FL_57"~"jury", third_scenario =="FL_58"~"noise", third_scenario =="FL_56"~"music", third_scenario =="FL_55"~"jay",TRUE~ scenario))data_long <- data_long %>%mutate(fourth_scenario =case_when( fourth_scenario =="FL_60"~"loiter", fourth_scenario =="FL_59"~"brights", fourth_scenario =="FL_57"~"jury", fourth_scenario =="FL_58"~"noise", fourth_scenario =="FL_56"~"music", fourth_scenario =="FL_55"~"jay",TRUE~ scenario))data_long <- data_long %>%mutate(fifth_scenario =case_when( fifth_scenario =="FL_60"~"loiter", fifth_scenario =="FL_59"~"brights", fifth_scenario =="FL_57"~"jury", fifth_scenario =="FL_58"~"noise", fifth_scenario =="FL_56"~"music", fifth_scenario =="FL_55"~"jay",TRUE~ scenario))data_long <- data_long %>%mutate(sixth_scenario =case_when( sixth_scenario =="FL_60"~"loiter", sixth_scenario =="FL_59"~"brights", sixth_scenario =="FL_57"~"jury", sixth_scenario =="FL_58"~"noise", sixth_scenario =="FL_56"~"music", sixth_scenario =="FL_55"~"jay",TRUE~ scenario))# column for order the scenario was seendata_long <- data_long %>%mutate(presentation_order =case_when( scenario == first_scenario ~"first", scenario == second_scenario ~"second", scenario == third_scenario ~"third", scenario == fourth_scenario ~"fourth", scenario == fifth_scenario ~"fifth", scenario == sixth_scenario ~"sixth",TRUE~"not found" ))# column for whether the target was a stranger or close otherdata_long <- data_long %>%mutate(relationship =case_when( presentation_order =="first"& color_1 =="#FF5733"~"stranger", presentation_order =="first"& color_1 =="blue"~"close other", presentation_order =="second"& color_2 =="#FF5733"~"stranger", presentation_order =="second"& color_2 =="blue"~"close other", presentation_order =="third"& color_3 =="#FF5733"~"stranger", presentation_order =="third"& color_3 =="blue"~"close other", presentation_order =="fourth"& color_4 =="#FF5733"~"stranger", presentation_order =="fourth"& color_4 =="blue"~"close other", presentation_order =="fifth"& color_5 =="#FF5733"~"stranger", presentation_order =="fifth"& color_5 =="blue"~"close other", presentation_order =="sixth"& color_6 =="#FF5733"~"stranger", presentation_order =="sixth"& color_6 =="blue"~"close other",TRUE~"unknown" ))data_long <- data_long %>%mutate(corresponding_name =case_when( presentation_order =="first"~ name_1, presentation_order =="second"~ name_2, presentation_order =="third"~ name_3, presentation_order =="fourth"~ name_4, presentation_order =="fifth"~ name_5, presentation_order =="sixth"~ name_6,TRUE~NA_character_ ) )# Assign the appropriate relationship code or label as "stranger"data_long <- data_long %>%mutate(relationship_code =case_when( corresponding_name == close1_name ~ close1_code, corresponding_name == close2_name ~ close2_code, corresponding_name == close3_name ~ close3_code,TRUE~"stranger" ) )# column for how much participants like the close otherdata_long <- data_long %>%mutate(likeClose =case_when( corresponding_name == close1_name ~ likeClose1_1, corresponding_name == close2_name ~ likeClose2_1, corresponding_name == close3_name ~ likeClose3_1,TRUE~"n/a" ) )# making factor variables factorsdata_long <- data_long %>%mutate_at(vars(confront,didBreak,interaction, order,Gender), as.factor)```# Individual Characteristics## Normative Alignment```{r}ggplot(data, aes(x = normComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Perceived Legitimacy of Law", x =" ", y ="Count") +theme_minimal()```### By political group```{r}ggplot(data, aes(x = normComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Perceived Legitimacy of Law", x =" ", y ="Count") +theme_minimal() +facet_wrap("political_group")```### By White```{r}ggplot(data, aes(x = normComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Perceived Legitimacy of Law", x =" ", y ="Count") +theme_minimal() +facet_wrap("White")```### By URM```{r}ggplot(data, aes(x = normComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Perceived Legitimacy of Law", x =" ", y ="Count") +theme_minimal() +facet_wrap("URM")```### By gender```{r}ggplot(data, aes(x = normComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Perceived Legitimacy of Law", x =" ", y ="Count") +theme_minimal() +facet_wrap("Gender_TEXT")```### By age```{r}ggplot(data, aes(x = normComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Perceived Legitimacy of Law", x =" ", y ="Count") +theme_minimal() +facet_wrap("age_split")```## Social Dominance Orientation```{r}ggplot(data, aes(x = SDOcomp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Social Dominance Orientation", x =" ", y ="Count") +theme_minimal()```### By political Group```{r}ggplot(data, aes(x = SDOcomp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Social Dominance Orientation", x =" ", y ="Count") +theme_minimal() +facet_wrap("political_group")```### By White```{r}ggplot(data, aes(x = SDOcomp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Social Dominance Orientation", x =" ", y ="Count") +theme_minimal() +facet_wrap("White")```### By URM```{r}ggplot(data, aes(x = SDOcomp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Social Dominance Orientation", x =" ", y ="Count") +theme_minimal() +facet_wrap("URM")```### By gender```{r}ggplot(data, aes(x = SDOcomp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Social Dominance Orientation", x =" ", y ="Count") +theme_minimal() +facet_wrap("Gender_TEXT")```### By age```{r}ggplot(data, aes(x = SDOcomp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Social Dominance Orientation", x =" ", y ="Count") +theme_minimal() +facet_wrap("age_split")```## Belief in a Just World```{r}ggplot(data, aes(x = bjwComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Belief in a Just World", x =" ", y ="Count") +theme_minimal()```### By political Group```{r}ggplot(data, aes(x = bjwComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Belief in a Just World", x =" ", y ="Count") +theme_minimal() +facet_wrap("political_group")```### By White```{r}ggplot(data, aes(x = bjwComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Belief in a Just World", x =" ", y ="Count") +theme_minimal() +facet_wrap("White")```### By URM```{r}ggplot(data, aes(x = bjwComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Belief in a Just World", x =" ", y ="Count") +theme_minimal() +facet_wrap("URM")```### By gender```{r}ggplot(data, aes(x = bjwComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Belief in a Just World", x =" ", y ="Count") +theme_minimal() +facet_wrap("Gender_TEXT")```### By age```{r}ggplot(data, aes(x = bjwComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Belief in a Just World", x =" ", y ="Count") +theme_minimal() +facet_wrap("age_split")```## Right Wing Authoritarianism```{r}ggplot(data, aes(x = RWAComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Right Wing Authoritarianism", x =" ", y ="Count") +theme_minimal()```### By political Group```{r}ggplot(data, aes(x = RWAComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Right Wing Authoritarianism", x =" ", y ="Count") +theme_minimal() +facet_wrap("political_group")```### By White```{r}ggplot(data, aes(x = RWAComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Right Wing Authoritarianism", x =" ", y ="Count") +theme_minimal() +facet_wrap("White")```### By URM```{r}ggplot(data, aes(x = RWAComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Right Wing Authoritarianism", x =" ", y ="Count") +theme_minimal() +facet_wrap("URM")```### By gender```{r}ggplot(data, aes(x = RWAComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Right Wing Authoritarianism", x =" ", y ="Count") +theme_minimal() +facet_wrap("Gender_TEXT")```### By age```{r}ggplot(data, aes(x = RWAComp)) +geom_histogram(binwidth =1, color ="black", alpha =0.7) +labs(title ="Right Wing Authoritarianism", x =" ", y ="Count") +theme_minimal() +facet_wrap("age_split")```# Should police officer initiate interaction?## Main plot```{r}Interaction_plot <-ggplot(data_long, aes(x=relationship, fill=interaction)) +geom_bar(position="dodge") +labs(x="relationship", y="Count", fill="1=Yes, 0=No", title ="Should police officer initiate interaction?") +theme_minimal()print(Interaction_plot)```### Statistical testing```{r}contingency_table <-table(data_long$relationship, data_long$interaction)# Print the contingency table to see the countsprint(contingency_table)# Perform the chi-square testchisq.test(contingency_table)stranger_data <- data_long %>%filter(relationship =="stranger")contingency_table <-table(stranger_data$relationship, stranger_data$interaction)# Print the contingency table to see the countsprint(contingency_table)# Perform the chi-square testchisq.test(contingency_table)```## Plot for each scenario```{r}Interaction_plot <-ggplot(data_long, aes(x=relationship, fill=interaction)) +geom_bar(position="dodge") +labs(x="relationship", y="Count", fill="1=Yes, 0=No", title ="Should police officer initiate interaction?") +theme_minimal() +facet_wrap("scenario")print(Interaction_plot)```### Statistical testing```{r}jay_data <- data_long %>%filter(scenario =="jay")brights_data <- data_long %>%filter(scenario =="brights")jury_data <- data_long %>%filter(scenario =="jury")loiter_data <- data_long %>%filter(scenario =="loiter")music_data <- data_long %>%filter(scenario =="music")noise_data <- data_long %>%filter(scenario =="noise")contingency_table_jay <-table(jay_data$relationship, jay_data$interaction)contingency_table_brights <-table(brights_data$relationship, brights_data$interaction)contingency_table_jury <-table(jury_data$relationship, jury_data$interaction)contingency_table_loiter <-table(loiter_data$relationship, loiter_data$interaction)contingency_table_music <-table(music_data$relationship, music_data$interaction)contingency_table_noise <-table(noise_data$relationship, noise_data$interaction)# Print the contingency table to see the countsprint(contingency_table_jay)print(contingency_table_brights)print(contingency_table_jury)print(contingency_table_loiter)print(contingency_table_music)print(contingency_table_noise)# Perform the chi-square testchisq.test(contingency_table_jay)chisq.test(contingency_table_brights)chisq.test(contingency_table_jury)chisq.test(contingency_table_loiter)chisq.test(contingency_table_music)chisq.test(contingency_table_noise)```# Would you prefer to confront the person yourself, or have a police officer confront them?## Main plot```{r, fig.width=10, fig.height=8}confront_plot <-ggplot(data_long, aes(x=relationship, fill=confront)) +geom_bar(position="dodge") +labs(x="relationship", y="Count", fill="1=Confront them myself, 2=Have a police officer confront them", title ="Would you prefer to confront the person yourself, or have a police officer confront them?") +theme_minimal()print(confront_plot)```### Statistical testing```{r}contingency_table <-table(data_long$relationship, data_long$confront)# Print the contingency table to see the countsprint(contingency_table)# Perform the chi-square testchisq.test(contingency_table)```## Plot for each scenario```{r, fig.width=10, fig.height=8}confront_plot <-ggplot(data_long, aes(x=relationship, fill=confront)) +geom_bar(position="dodge") +labs(x="relationship", y="Count", fill="1=Yes, 0=No", title ="Would you prefer to confront the person yourself, or have a police officer confront them?") +theme_minimal() +facet_wrap("scenario")print(confront_plot)```### Statistical testing```{r}contingency_table_jay <-table(jay_data$relationship, jay_data$confront)contingency_table_brights <-table(brights_data$relationship, brights_data$confront)contingency_table_jury <-table(jury_data$relationship, jury_data$confront)contingency_table_loiter <-table(loiter_data$relationship, loiter_data$confront)contingency_table_music <-table(music_data$relationship, music_data$confront)contingency_table_noise <-table(noise_data$relationship, noise_data$confront)# Print the contingency table to see the countsprint(contingency_table_jay)print(contingency_table_brights)print(contingency_table_jury)print(contingency_table_loiter)print(contingency_table_music)print(contingency_table_noise)# Perform the chi-square testchisq.test(contingency_table_jay)chisq.test(contingency_table_brights)chisq.test(contingency_table_jury)chisq.test(contingency_table_loiter)chisq.test(contingency_table_music)chisq.test(contingency_table_noise)```# Did this person break the rule?## Main plot```{r}didBreak_plot <-ggplot(data_long, aes(x=relationship, fill=didBreak)) +geom_bar(position="dodge") +labs(x="relationship", y="Count", fill="1=Yes, 0=No", title ="Did this person break the rule?") +theme_minimal()print(didBreak_plot)```## Statistical testing```{r}contingency_table <-table(data_long$relationship, data_long$didBreak)# Print the contingency table to see the countsprint(contingency_table)# Perform the chi-square testchisq.test(contingency_table)```## Plot for each scenario```{r}didBreak_plot <-ggplot(data_long, aes(x=relationship, fill=didBreak)) +geom_bar(position="dodge") +labs(x="relationship", y="Count", fill="1=Yes, 0=No", title ="Did this person break the rule?") +theme_minimal() +facet_wrap("scenario")print(didBreak_plot)```### Statistical testing```{r}contingency_table_jay <-table(jay_data$relationship, jay_data$didBreak)contingency_table_brights <-table(brights_data$relationship, brights_data$didBreak)contingency_table_jury <-table(jury_data$relationship, jury_data$didBreak)contingency_table_loiter <-table(loiter_data$relationship, loiter_data$didBreak)contingency_table_music <-table(music_data$relationship, music_data$didBreak)contingency_table_noise <-table(noise_data$relationship, noise_data$didBreak)# Print the contingency table to see the countsprint(contingency_table_jay)print(contingency_table_brights)print(contingency_table_jury)print(contingency_table_loiter)print(contingency_table_music)print(contingency_table_noise)# Perform the chi-square testchisq.test(contingency_table_jay)chisq.test(contingency_table_brights)chisq.test(contingency_table_jury)chisq.test(contingency_table_loiter)chisq.test(contingency_table_music)chisq.test(contingency_table_noise)```# Does punishing people who break the rule help maintain order?## Main plot```{r}order_plot <-ggplot(data_long, aes(x=relationship, fill=order)) +geom_bar(position="dodge") +labs(x="relationship", y="Count", fill="1=Yes, 0=No", title ="Does punishing people who break the rule help maintain order?") +theme_minimal()print(order_plot)```### Statistical testing```{r}contingency_table <-table(data_long$relationship, data_long$order)# Print the contingency table to see the countsprint(contingency_table)# Perform the chi-square testchisq.test(contingency_table)```## Plot for each scenario* jaywalking significant```{r}order_plot <-ggplot(data_long, aes(x=relationship, fill=order)) +geom_bar(position="dodge") +labs(x="relationship", y="Count", fill="1=Yes, 0=No", title ="Does punishing people who break the rule help maintain order?") +theme_minimal() +facet_wrap("scenario")print(order_plot)```### Statistical testing```{r}contingency_table_jay <-table(jay_data$relationship, jay_data$order)contingency_table_brights <-table(brights_data$relationship, brights_data$order)contingency_table_jury <-table(jury_data$relationship, jury_data$order)contingency_table_loiter <-table(loiter_data$relationship, loiter_data$order)contingency_table_music <-table(music_data$relationship, music_data$order)contingency_table_noise <-table(noise_data$relationship, noise_data$order)# Print the contingency table to see the countsprint(contingency_table_jay)print(contingency_table_brights)print(contingency_table_jury)print(contingency_table_loiter)print(contingency_table_music)print(contingency_table_noise)# Perform the chi-square testchisq.test(contingency_table_jay)chisq.test(contingency_table_brights)chisq.test(contingency_table_jury)chisq.test(contingency_table_loiter)chisq.test(contingency_table_music)chisq.test(contingency_table_noise)```# Would you want to anonymously report this person? ## Main plot + distribution```{r, fig.width=10, fig.height=8}anonReport_plot <-ggplot(data_long, aes(x = relationship, y = anonReport)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = anonReport), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood they would report", title ="Would you want to anonymously report this person?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(anonReport_plot)```## Main plot + distribution for each scenario```{r, fig.width=10, fig.height=8}anonReport_plot <-ggplot(data_long, aes(x = relationship, y = anonReport)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = anonReport), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood they would report", title ="Would you want to anonymously report this person?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(anonReport_plot)```# Would you want to publicly report this person?## Main plot + distribution```{r, fig.width=10, fig.height=8}publicReport_plot <-ggplot(data_long, aes(x = relationship, y = publicReport)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = publicReport), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood they would report", title ="Would you want to publicly report this person?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(publicReport_plot)```## Main plot + distribution for each scenario```{r, fig.width=10, fig.height=8}publicReport_plot <-ggplot(data_long, aes(x = relationship, y = publicReport)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = publicReport), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood they would report", title ="Would you want to publicly report this person?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =25),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(publicReport_plot)```# Do you want this person to know that you reported him/her?## Main plot + distribution```{r, fig.width=10, fig.height=8}knowReport_plot <-ggplot(data_long, aes(x = relationship, y = knowReport)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = knowReport), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood they want to be known it was them", title ="Do you want this person to know that you reported him/her?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =20),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =15, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(knowReport_plot)```## Main plot + distribution for each scenario```{r, fig.width=10, fig.height=8}knowReport_plot <-ggplot(data_long, aes(x = relationship, y = knowReport)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = knowReport), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood they want to be known it was them", title ="Do you want this person to know that you reported him/her?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =20),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =15, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(knowReport_plot)```# How punishable is the act?## Main plot + distribution```{r, fig.width=10, fig.height=8}punish_plot <-ggplot(data_long, aes(x = relationship, y = punish)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = punish), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="How punishable they would report", title ="How punishable is the act?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =35),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(punish_plot)```## Main plot + distribution for each scenario```{r, fig.width=10, fig.height=8}punish_plot <-ggplot(data_long, aes(x = relationship, y = punish)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = punish), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="How punishable they would report", title ="How punishable is the act?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =35),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(punish_plot)```# How morally bad is the act?## Main plot + distribution```{r, fig.width=10, fig.height=8}moral_plot <-ggplot(data_long, aes(x = relationship, y = moral)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = moral), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="How morally bad they would report", title ="How morally bad is the act?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =35),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(moral_plot)```## Main plot + distribution for each scenario```{r, fig.width=10, fig.height=8}moral_plot <-ggplot(data_long, aes(x = relationship, y = moral)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = moral), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="How morally bad they would report", title ="How morally bad is the act?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =35),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(moral_plot)```# How justified is it for the legal system to be involved when a person violate a speficit phantom rule?## Main plot + distribution```{r, fig.width=10, fig.height=8}justified_plot <-ggplot(data_long, aes(x = relationship, y = justified)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = justified), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Justified level", title ="How justified is it for the legal system to be involved when a person violate the rule?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =15),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(justified_plot)```## Main plot + distribution for each scenario```{r, fig.width=10, fig.height=8}justified_plot <-ggplot(data_long, aes(x = relationship, y = justified)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = justified), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Justified level", title ="How justified is it for the legal system to be involved when a person violate the rule?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =15),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(justified_plot)```# How legitimate is the law against the rule?## Main plot + distribution```{r, fig.width=10, fig.height=8}legit_plot <-ggplot(data_long, aes(x = relationship, y = legit)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = legit), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Legitimate level", title ="How legitimate is the law against the rule?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =30),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(legit_plot)```## Main plot + distribution for each scenario```{r, fig.width=10, fig.height=8}legit_plot <-ggplot(data_long, aes(x = relationship, y = legit)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = legit), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Legitimate level", title ="How legitimate is the law against the rule?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =30),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(legit_plot)```# How fair is the law against the violation of the phantom rule?## Main plot + distribution```{r, fig.width=10, fig.height=8}fair_plot <-ggplot(data_long, aes(x = relationship, y = fair)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = fair), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Fair level", title ="How fair is the law on the phantom rule?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =35),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(fair_plot)```## Main plot + distribution for each scenario```{r, fig.width=10, fig.height=8}fair_plot <-ggplot(data_long, aes(x = relationship, y = fair)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = fair), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Fair level", title ="How fair is the law on the phantom rule?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =35),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(fair_plot)```# How likely is it that this person will break rules in the future?## Main plot + distribution```{r, fig.width=10, fig.height=8}breakP_plot <-ggplot(data_long, aes(x = relationship, y = breakP)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = breakP), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood to break rule", title ="How likely is it that this person will break rules in the future?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =20),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(breakP_plot)```## Main plot + distribution for each scenario```{r, fig.width=10, fig.height=8}breakP_plot <-ggplot(data_long, aes(x = relationship, y = breakP)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = breakP), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Likelihood to break rule", title ="How likely is it that this person will break rules in the future?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =20),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(breakP_plot)```# How much do you feel the actions of this person were harmful to others?## Main plot + distribution```{r, fig.width=10, fig.height=8}harmP_plot <-ggplot(data_long, aes(x = relationship, y = harmP)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = harmP), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Level of harmfulness", title ="How much do you feel the actions of this person were harmful to others?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =20),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(harmP_plot)```## Main plot + distribution for each scenario```{r, fig.width=10, fig.height=8}harmP_plot <-ggplot(data_long, aes(x = relationship, y = harmP)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = harmP), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Level of harmfulness", title ="How much do you feel the actions of this person were harmful to others?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =20),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(0, 100)) +scale_y_continuous(breaks =c(25,50,75,100)) #-100-100: -100, -50, 0, 50, 100print(harmP_plot)```# Should the legal system consider getting rid of the law prohibiting the phantom rule?## Main plot + distribution```{r, fig.width=10, fig.height=8}remove_plot <-ggplot(data_long, aes(x = relationship, y = remove)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = remove), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="How much they would agree or disagree with the statement", title ="The legal system should consider getting rid of the law prohibiting the phantom rule.") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =17),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =15, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(-100, 100)) +scale_y_continuous(breaks =c(-100, -50, 0, 50, 100)) #-100-100: -100, -50, 0, 50, 100print(remove_plot)```## Main plot + distribution for each scenario```{r, fig.width=10, fig.height=8}remove_plot <-ggplot(data_long, aes(x = relationship, y = remove)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = remove), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="How much they would agree or disagree with the statement", title ="The legal system should consider getting rid of the law prohibiting the phantom rule.") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =17),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =15, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(-100, 100)) +scale_y_continuous(breaks =c(-100, -50, 0, 50, 100)) #-100-100: -100, -50, 0, 50, 100print(remove_plot)```# Assuming this person did break the rule, how would you rate their moral character?## Main plot + distribution```{r, fig.width=10, fig.height=8}moralP_plot <-ggplot(data_long, aes(x = relationship, y = moralP)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = moralP), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Rating of moral character", title ="Assuming this person did break the rule, how would you rate their moral character?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =17),axis.text.x =element_text(face ="plain", size =25, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +coord_cartesian(ylim =c(-100, 100)) +scale_y_continuous(breaks =c(-100, -50, 0, 50, 100)) #-100-100: -100, -50, 0, 50, 100print(moralP_plot)```## Main plot + distribution for each scenario```{r, fig.width=10, fig.height=8}moralP_plot <-ggplot(data_long, aes(x = relationship, y = moralP)) +geom_point(stat ="summary", fun ="mean", size =4, position =position_dodge(width =0.25)) +geom_violin(aes(fill = moralP), alpha =0.3, position =position_dodge(width =0.25)) +# plotting distributionsstat_summary(fun.data ="mean_cl_normal", geom ="errorbar", position =position_dodge(width =0.25), width =0.2, size =1.5) +labs(x ="Relationship", y ="Rating of moral character", title ="Assuming this person did break the rule, how would you rate their moral character?") +theme_minimal(base_size =15) +# Use a minimal themetheme(plot.title =element_text(hjust =0.5, size =17),axis.text.x =element_text(face ="plain", size =17, color ="black"),axis.text.y =element_text(face ="plain", size =25, color ="black"),axis.title.y =element_text(face ="plain", size =30, color ="black"), axis.title.x =element_text(face ="plain", size =30, color ="black"),panel.grid.major =element_line(color ="gray"), # Set major grid lines to graypanel.grid.minor =element_blank(), # Hide minor grid linespanel.background =element_rect(fill ="white", color ="white"),panel.border =element_rect(color ="black", fill =NA, size =1) ) +facet_wrap("scenario") +coord_cartesian(ylim =c(-100, 100)) +scale_y_continuous(breaks =c(-100, -50, 0, 50, 100)) #-100-100: -100, -50, 0, 50, 100print(moralP_plot)```
Social Dominance Orientation
Code
By political Group
Code
By White
Code
By URM
Code
By gender
Code
By age
Code