1 Import & clean data

1.1 Pull survey from Qualtrics

surveys <- all_surveys()
data_raw <- fetch_survey(surveyID = surveys$id[9], verbose = T, force_request = T)
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
# Questions key
allQs <- survey_questions(surveyID = surveys$id[9])

# compCheck1 <- c('comp1', 'Q330', 'comp2') #T,T,F
# compCheck2 <- c('comp4', 'comp5', 'comp6') #F,T,T
# 1_1 generous, 2_1 likely, 3_1 honest, 4_1 appear generous, 5_1 appear honest

1.2 Exclude unfinished surveys or previews

data <- filter(data_raw, Status!="Survey Preview", Finished==TRUE, grepl('2021-01-19', StartDate))
data$subN <- rownames(data)

data %>%
  filter(subN == 1) %>%
  t() %>%
  as.data.frame() %>%
  drop_na() -> samplesub

Extracted 50 clean participants.

1.3 Check duration

data %>%
  filter(!is.na(`Duration (in seconds)`)) %>%
  mutate(Duration = as.numeric(`Duration (in seconds)`)/60) %>% 
  ggplot(aes(x=Duration)) +
  geom_histogram(binwidth = 1, color ='black', fill ='gray65')

1.4 Look at comments

data %>%
  dplyr::select(subN, Q40.2, Q40.3, Q40.4) %>%
  DT::datatable()
# problemsIDs <- c(5, 9)
# nonsenseIDs <- c()
# data <- filter(data, !subN %in% problemsIDs, !subN %in% nonsenseIDs) 

2 Comprehension Check

2.1 Accuracy by Question

#compQs <- c('Q8.1', 'Q8.2', 'Q8.3', 'Q12.1', 'Q12.2', 'Q12.3')
compQs <- c('comp1', 'comp2', 'Q330', 'comp4', 'comp5', 'comp6')
comp_tidy <- data %>%
  dplyr::select(subN, comp1, comp2, Q330, comp4, comp5, comp6) %>%
  gather(compQs, key = "question", value = "answer")

comp_tidy$answer <- as.numeric(comp_tidy$answer)

comp_tidy %>%
  group_by(question) %>%
  summarise(comp_mean = mean(answer, na.rm=TRUE)) %>%
  ggplot(aes(x = question, y = comp_mean)) + 
  ylim(0,1) +
  geom_point() 

2.2 Accuracy by Participant

compData <- data %>%
  dplyr::select(subN, comp1, comp2, Q330, comp4, comp5, comp6) %>%
  mutate(accuracy = (comp1==T) + (comp2==F) + (Q330==T) + (comp4==F) + (comp5==T) + (comp6==T)) 

ggplot(compData, aes(x=accuracy)) + 
  geom_histogram(binwidth = 1, color ='black', fill ='gray65')

3 Main data

3.1 By question and trial type

Trials 1:4 are claimed(choice)-claimed(narrative), 5:8 are notclaimed-notclaimed, 9:12 are claimed-notclaimed, 13:16 are notclaimed-claimed, 17:20 are unknown-claimed, 21-24 are unknown-notclaimed, 25 is claimed-unknown, 26 is notclaimed-unknown, 27 is unknown-unknown.

# Exclude if less than 5/6 comprehension checks correct 
compFailed <- filter(compData, compData$accuracy < 5) 
rawN <- length(data$subN)
failN <- length(compFailed$subN)
cleanN <- rawN - failN

q_key <- read_csv("/Users/judykim/Dropbox/Judy Moral Narratives/Claim Task Perception/nar_perception_gif_key.csv")
q_key <- bind_rows(replicate(cleanN, q_key, simplify=FALSE))

data <- filter(data, !subN %in% compFailed$subN)

Excluding 9 participants for getting more than 1 comprehension question wrong. This leaves 41 participants.

3.1.1 "Does the worker seem selfish (0) or generous (100)? "

data_long <- data %>% 
  dplyr::select(subN, generous_1_1:app_honest_27_1) %>%
  pivot_longer(generous_1_1:app_honest_27_1, names_to="questions",values_to="responses")

data_long <- data_long %>% 
  filter(!grepl('Q',questions)) %>%
  mutate(q_key)

d_generous <- data_long %>% 
  dplyr::select(subN, questions, responses, trial, choice, narrative, narrative_v) %>%
  filter(grepl('generous',questions)) %>%
  group_by(choice, narrative, narrative_v, trial) %>%
  summarise(M = mean(responses, na.rm=T), SD = sd(responses, na.rm=T),
            NN = length(responses))

d_generous$SE <- d_generous$SD/sqrt(d_generous$NN)
d_generous$Low <- d_generous$M - 1.96*d_generous$SE
d_generous$High <- d_generous$M + 1.96*d_generous$SE

d_generous %>% 
  ggplot(aes(x=trial, y=M)) + 
  geom_point() + 
  geom_errorbar(aes(ymin=Low, ymax=High, width=.1)) + 
  ylim(0,100) +
  geom_point(aes(x=trial,y=M), color="steelblue", alpha=.3) +
  ggtitle("Does the worker seem selfish or generous?") + 
  ylab("Ratings") + xlab("Type of claim + narrative") 

3.1.2 "How honest do you think the worker was about their motivations? "

d_honest <- data_long %>% 
  dplyr::select(subN, questions, responses, trial, choice, narrative, narrative_v) %>%
  filter(grepl('honest',questions) & !grepl('app',questions)) %>%
  group_by(choice, narrative, narrative_v, trial) %>%
  summarise(M = mean(responses, na.rm=T), SD = sd(responses, na.rm=T),
            NN = length(responses))

d_honest$SE <- d_honest$SD/sqrt(d_honest$NN)
d_honest$Low <- d_honest$M - 1.96*d_honest$SE
d_honest$High <- d_honest$M + 1.96*d_honest$SE

d_honest %>% 
  ggplot(aes(x=trial, y=M)) + 
  geom_point() + 
  geom_errorbar(aes(ymin=Low, ymax=High, width=.1)) + 
  ylim(0,100) +
  geom_point(aes(x=trial,y=M), color="steelblue", alpha=.3) +
  ggtitle("How honest do you think the worker was about their motivations?") + 
  ylab("Ratings") + xlab("Type of claim + narrative") 

3.1.3 "How much do you think the worker cared about appearing generous in their statement? "

d_app_gen <- data_long %>% 
  dplyr::select(subN, questions, responses, trial, choice, narrative, narrative_v) %>%
  filter(grepl('app_gen',questions)) %>%
  group_by(choice, narrative, narrative_v, trial) %>%
  summarise(M = mean(responses, na.rm=T), SD = sd(responses, na.rm=T),
            NN = length(responses))

d_app_gen$SE <- d_app_gen$SD/sqrt(d_app_gen$NN)
d_app_gen$Low <- d_app_gen$M - 1.96*d_app_gen$SE
d_app_gen$High <- d_app_gen$M + 1.96*d_app_gen$SE

d_app_gen %>% 
  ggplot(aes(x=trial, y=M)) + 
  geom_point() + 
  geom_errorbar(aes(ymin=Low, ymax=High, width=.1)) + 
  ylim(0,100) +
  geom_point(aes(x=trial,y=M), color="steelblue", alpha=.3) +
  ggtitle("How much do you think the worker cared about appearing generous in their statement") + 
  ylab("Ratings") + xlab("Type of claim + narrative") 

3.1.4 "How much do you think the worker cared about their statement being believable?"

d_app_honest <- data_long %>% 
  dplyr::select(subN, questions, responses, trial, choice, narrative, narrative_v) %>%
  filter(grepl('app_honest',questions)) %>%
  group_by(choice, narrative, narrative_v, trial) %>%
  summarise(M = mean(responses, na.rm=T), SD = sd(responses, na.rm=T),
            NN = length(responses))

d_app_honest$SE <- d_app_honest$SD/sqrt(d_app_honest$NN)
d_app_honest$Low <- d_app_honest$M - 1.96*d_app_honest$SE
d_app_honest$High <- d_app_honest$M + 1.96*d_app_honest$SE

d_app_honest %>% 
  ggplot(aes(x=trial, y=M)) + 
  geom_point() + 
  geom_errorbar(aes(ymin=Low, ymax=High, width=.1)) + 
  ylim(0,100) +
  geom_point(aes(x=trial,y=M), color="steelblue", alpha=.3) +
  ggtitle("How much do you think the worker cared about their statement being believable?") + 
  ylab("Ratings") + xlab("Type of claim + narrative") 

3.1.5 "How likely do you think it is that the worker claimed the raise? "

d_likely <- data_long %>% 
  dplyr::select(subN, questions, responses, trial, choice, narrative, narrative_v) %>%
  filter(grepl('likely',questions)) %>%
  group_by(choice, narrative, narrative_v, trial) %>%
  summarise(M = mean(responses, na.rm=T), SD = sd(responses, na.rm=T),
            NN = length(responses))

d_likely$SE <- d_likely$SD/sqrt(d_likely$NN)
d_likely$Low <- d_likely$M - 1.96*d_likely$SE
d_likely$High <- d_likely$M + 1.96*d_likely$SE

d_likely %>% 
  ggplot(aes(x=trial, y=M)) + 
  geom_point() + 
  geom_errorbar(aes(ymin=Low, ymax=High, width=.1)) + 
  ylim(0,100) + xlim(0,27) +
  geom_point(aes(x=trial,y=M), color="steelblue", alpha=.3) +
  ggtitle("How likely do you think it is that the worker claimed the raise?") + 
  ylab("Ratings") + xlab("Type of claim + narrative")