Phantom Rule Pilot 1

Author

Marcus, Amanda

Published

July 23, 2024

Setup

Libraries

Code
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 files
setwd("~/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 CI
                 size = 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 fill
          plot.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 title
          panel.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 typo
data_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-white
data_raw$White <- ifelse(grepl("White", data_raw$Race_Ethnicity_TEXT), "White", "Non-White")

# making a column for URM vs non-URM
urm_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_harmP
data_raw$jay_harmP <- as.numeric(data_raw$jay_harmP)
data_raw$jay_harmP <- (data_raw$jay_harmP + 100) / 2

Individual Characteristics

Code
# making the individual characteristics numeric
data_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_1R
data_raw$RWA_4 <- 8 - data_raw$RWA_4R
data_raw$RWA_5 <- 8 - data_raw$RWA_5R

## making composite variables for individual characteristics
data_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 splits
data_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

Code
#### 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 data
data <- data %>% filter(!(prolificID %in% c("66574c6a2a79bcd8ac8a00e8", "662d15c45fc2c1ca89b362bf")))

# changing numeric DVs to numeric
data <- data %>% mutate_at(vars(loiter_interaction:jay_fair, Age), as.numeric)

## median split on age
data <- 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 columns
data_long <- data_long %>%
  separate(scenario_order, into= c("first_scenario", "second_scenario", "third_scenario", "fourth_scenario", "fifth_scenario", "sixth_scenario"), sep="\\|")

# renaming scenarios
data_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 seen
data_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 other
data_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 other
data_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 factors
data_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")

Should police officer initiate interaction?

Main plot

Code
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

Code
contingency_table <- table(data_long$relationship, data_long$interaction)

# Print the contingency table to see the counts
print(contingency_table)
             
                0   1
  close other 222 222
  stranger    214 230
Code
# Perform the chi-square test
chisq.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 counts
print(contingency_table)
          
             0   1
  stranger 214 230
Code
# Perform the chi-square test
chisq.test(contingency_table)

    Chi-squared test for given probabilities

data:  contingency_table
X-squared = 0.57658, df = 1, p-value = 0.4477

Plot for each scenario

Code
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

Code
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 counts
print(contingency_table_jay)
             
               0  1
  close other 32 40
  stranger    41 35
Code
print(contingency_table_brights)
             
               0  1
  close other 33 45
  stranger    20 50
Code
print(contingency_table_jury)
             
               0  1
  close other 45 26
  stranger    44 33
Code
print(contingency_table_loiter)
             
               0  1
  close other 46 32
  stranger    43 27
Code
print(contingency_table_music)
             
               0  1
  close other 50 24
  stranger    50 24
Code
print(contingency_table_noise)
             
               0  1
  close other 16 55
  stranger    16 61
Code
# Perform the chi-square test
chisq.test(contingency_table_jay)

    Pearson's Chi-squared test with Yates' continuity correction

data:  contingency_table_jay
X-squared = 0.98266, df = 1, p-value = 0.3215
Code
chisq.test(contingency_table_brights)

    Pearson's Chi-squared test with Yates' continuity correction

data:  contingency_table_brights
X-squared = 2.4602, df = 1, p-value = 0.1168
Code
chisq.test(contingency_table_jury)

    Pearson's Chi-squared test with Yates' continuity correction

data:  contingency_table_jury
X-squared = 0.36753, df = 1, p-value = 0.5444
Code
chisq.test(contingency_table_loiter)

    Pearson's Chi-squared test with Yates' continuity correction

data:  contingency_table_loiter
X-squared = 0.018584, df = 1, p-value = 0.8916
Code
chisq.test(contingency_table_music)

    Pearson's Chi-squared test

data:  contingency_table_music
X-squared = 0, df = 1, p-value = 1
Code
chisq.test(contingency_table_noise)

    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 counts
print(contingency_table)
             
                1   2
  close other 265 179
  stranger    254 190
Code
# Perform the chi-square test
chisq.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 counts
print(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 test
chisq.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 counts
print(contingency_table)
             
                0   1
  close other  53 391
  stranger     47 397
Code
# Perform the chi-square test
chisq.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 counts
print(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 test
chisq.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 counts
print(contingency_table)
             
                0   1
  close other 197 247
  stranger    206 238
Code
# Perform the chi-square test
chisq.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 counts
print(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 test
chisq.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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(moral_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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(harmP_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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(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 distributions
  stat_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 theme
  theme(
    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 gray
         panel.grid.minor = element_blank(),  # Hide minor grid lines
         panel.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, 100
print(moralP_plot)