All paticipants
Only participants not indicating knowledge of manipulation

load and define things

preprocess

#Pre-process from database          
#setwd('/Users/Allison/Documents/likeSpeak/experiment/psiturk_likespeak/')
setwd('/Documents/GRADUATE_SCHOOL/Projects/likeSpeak/experiment/psiturk_likespeak/')
db_name = "MGEtest4.db"
table_name = "RCI5"

sqlite    <- RSQLite::SQLite()
exampledb <- dbConnect(sqlite, db_name)
db_query = dbGetQuery(exampledb, paste("SELECT datastring FROM ", table_name, " WHERE status = 4", sep = ""))
#db_query = dbGetQuery(exampledb, paste("SELECT datastring FROM ", table_name, sep = ""))

d = data.frame()
for (i in 1:dim(db_query)[1]){
  if (!is.na(db_query$datastring[i])) {
    
    rthing = fromJSON(db_query$datastring[i])  # get datastring to r object
    
    # get trial data 
    k = rthing$data['trialdata']$trialdata
    k = k[k$phase != "INSTRUCTIONS",]
    
    # add participant info
    k$workerID = rthing$workerId
    k$hitId = rthing$hitId
    k$parentID = rthing$questiondata$parentID
    k$gen = rthing$questiondata$gen
    k$chain = rthing$questiondata$chain
    d = rbind(d, k)
  }
}

# drop weirdo columns
drops <- c("templates","template", "action")
d = d[,!(names(d) %in% drops)]

# make stuff factors
factor_cols <- names(d)[c(-9:-12, -16:-17)] 
numeric_cols <- names(d)[16:17] 
d[factor_cols] <- lapply(d[factor_cols], as.factor) 
d[numeric_cols] <- lapply(d[numeric_cols], as.numeric)

Drop participants who missed social manipulation check (both self and partner)

d = d %>%
    group_by(workerID) %>%
      mutate(self_guess_accuracy = self_guess_accuracy[!is.na(partner_guess_accuracy)],
             partner_guess_accuracy = partner_guess_accuracy[!is.na(partner_guess_accuracy)]) %>%
      filter(self_guess_accuracy != "incorrect" & partner_guess_accuracy != "incorrect")

# get rid of multiword responses
d$guessed_label_Nwords = sapply(gregexpr("\\S+", d$guessedLabel), length) 
d = d[d$guessed_label_Nwords != 2,]

Make all possible condition groups

d$groupCompare = as.factor(ifelse(d$particEstimator == "Overestimator" & 
                                    d$partnerEstimator == "Overestimator", "OO",
                                ifelse(d$particEstimator == "Overestimator" &
                                         d$partnerEstimator == "Underestimator", "OU",
                                       ifelse(d$particEstimator == "Underestimator" & 
                                                d$partnerEstimator == "Underestimator", "UU","UO"))))

d$groupCompare  <- factor(d$groupCompare, levels=c("OO", "UU", "OU", "UO"))

Likeability ratings

ggplot(d[!is.na(d$likableRating),], aes(x=as.factor(likableRating), 
                                        fill = condition)) +
  geom_bar(position="dodge") +
  ggtitle("Likeability") +
  xlab("rating") +
  ylim(0,7) +
  themeML                 

Likeability ratings by condition

likable = d %>%
  filter(phase == "QUESTIONNAIRE" & !is.na(likableRating)) %>%
  multi_boot(column="likableRating",
              summary_groups = c("condition"),
              statistics_functions = c("mean", "ci_lower","ci_upper"))

ggplot(likable, aes(y=mean, x = condition)) +
  geom_bar(position="dodge", stat="identity", fill = "red") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ggtitle("Likeability") +
  ylim(0,7) +
  themeML          

Likeability ratings by condition

likable = d %>%
  filter(phase == "QUESTIONNAIRE" & !is.na(likableRating)) %>%
  multi_boot(column="likableRating",
              summary_groups = c("groupCompare", "condition"),
              statistics_functions = c("mean", "ci_lower","ci_upper"))

ggplot(likable, aes(y=mean, x = groupCompare, fill=condition)) +
  geom_bar(position="dodge", stat="identity") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ggtitle("Likeability") +
  ylim(0,7) +
  themeML          

Workability ratings

ggplot(d[!is.na(d$howWellRating),], aes(x=as.factor(howWellRating), fill = condition)) +
  geom_bar(position="dodge") +  
  ggtitle("How well worked together") +
  xlab("rating") +
  ylim(0,10) +
  themeML                 

Workability ratings by condition

workable = d %>%
  filter(phase == "QUESTIONNAIRE" & !is.na(howWellRating)) %>%
  multi_boot(column="howWellRating",
              summary_groups = c("condition"),
              statistics_functions = c("mean", "ci_lower","ci_upper"))

ggplot(workable, aes(y=mean, x = condition)) +
  geom_bar(position="dodge", stat="identity", fill = "red") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ggtitle("How well worked together") +
  ylim(0,7) +
  themeML                 

Workability ratings by condition

workable = d %>%
  filter(phase == "QUESTIONNAIRE" & !is.na(howWellRating)) %>%
  multi_boot(column="howWellRating",
              summary_groups = c("groupCompare", "condition"),
              statistics_functions = c("mean", "ci_lower","ci_upper"))

ggplot(workable, aes(y=mean, x = groupCompare, fill = condition)) +
  geom_bar(position="dodge", stat="identity") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ggtitle("How well worked together") +
  ylim(0,7) +
  themeML                 

Edit distances

for (i in 1:dim(d)[1]){
      d$lev2[i] = adist(d$word[i], d$guessedLabel[i])
      d$ins[i] = drop(attr(adist(d$word[i], d$guessedLabel[i], counts = T), "counts"))[1]
      d$del[i] = drop(attr(adist(d$word[i], d$guessedLabel[i], counts = T), "counts"))[2]
      d$sub[i] = drop(attr(adist(d$word[i], d$guessedLabel[i], counts = T), "counts"))[3]
}

ggplot(d, aes(x=lev2, fill = condition)) +
  geom_bar(position="dodge", binwidth = 1) +  
  ggtitle("Edit distance") +
  xlab("edit distance") +
  themeML  

ggplot(d, aes(x=sub, fill = condition)) +
  geom_bar(position="dodge", binwidth = 1) +  
  ggtitle("substitutions") +
  xlab("subsitutions") +
  themeML  

led = d %>%
        group_by(condition)  %>%
        filter(phase == "TEST" & !is.na(lev2))  %>%
        multi_boot(column="lev2",
                    summary_groups = c("condition"),
                    statistics_functions = c("mean", "ci_lower","ci_upper"))
        
ggplot(led, aes(y=mean, x = condition)) +
  geom_bar(position="dodge", stat="identity", fill = "red") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ylim(0,6) +
  ggtitle("Levenshtein edit distance") +
  themeML 

led = d %>%
        filter(phase == "TEST" & !is.na(lev2))  %>%
        multi_boot(column="lev2",
                    summary_groups = c("groupCompare", "condition"),
                    statistics_functions = c("mean", "ci_lower","ci_upper"))
        
ggplot(led, aes(y=mean, x = groupCompare, fill = condition)) +
  geom_bar(position="dodge", stat="identity") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ylim(0,4) +
  ggtitle("Levenshtein edit distance") +
  themeML 

subs = d %>%
        filter(phase == "TEST" & !is.na(lev2))  %>%
        multi_boot(column="sub",
                    summary_groups = c("groupCompare", "condition"),
                    statistics_functions = c("mean", "ci_lower","ci_upper"))
        
ggplot(subs, aes(y=mean, x = groupCompare, fill = condition)) +
  geom_bar(position="dodge", stat="identity") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ylim(0,4) +
  ggtitle("substitutions") +
  themeML 

RTs

d$rt.log = log(d$rt)

rts = d %>%
        filter(!is.na(rt.log))  %>%
        multi_boot(column="rt.log",
                    summary_groups = c("groupCompare", "condition"),
                    statistics_functions = c("mean", "ci_lower","ci_upper"))


ggplot(rts, aes(y=mean, x = groupCompare, fill = "condition")) +
  geom_bar(position="dodge", stat="identity", fill = "red") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ggtitle("RTs") +
  ylim(0,10) +
  themeML 

Accuracy by condition

acc = d %>%
        group_by(workerID, condition)  %>%
        filter(!is.na(accuracy))  %>%
        mutate(correct = length(which(accuracy == "correct"))) %>%
        summarise(prop_correct = correct[1]/8) %>%
        multi_boot(column="prop_correct",
                    summary_groups = c("condition"),
                    statistics_functions = c("mean", "ci_lower","ci_upper"))


ggplot(acc, aes(y=mean, x = condition)) +
  geom_bar(position="dodge", stat="identity", fill = "red") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ylim(0,1) +
  ggtitle("Accuracy") +
  themeML 

Accuracy by condition

acc = d %>%
        group_by(workerID, groupCompare, condition)  %>%
        filter(!is.na(accuracy))  %>%
        mutate(correct = length(which(accuracy == "correct"))) %>%
        summarise(prop_correct = correct[1]/8) %>%
        multi_boot(column="prop_correct",
                    summary_groups = c("groupCompare", "condition"),
                    statistics_functions = c("mean", "ci_lower","ci_upper"))


ggplot(acc, aes(y=mean, x = groupCompare, fill = condition)) +
  geom_bar(position="dodge", stat="identity") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ylim(0,1) +
  ggtitle("Accuracy") +
  themeML 

#write.csv(d[d$phase == "TEST",c("workerID", "word", "guessedLabel")], "wordfilter.csv")

Correlation between likability and number of edits

p = d %>%
    group_by(workerID) %>%
    mutate(likableRating = likableRating[!is.na(likableRating)],
            howWellRating = howWellRating[!is.na(howWellRating)])
k = p %>%
    group_by(workerID, condition, groupCompare) %>%
    mutate(correct = length(which(accuracy == "correct"))) %>%
    summarise(edits = mean(lev2, na.rm = T),
              likable = mean(likableRating),
              howWell = mean(howWellRating),
              rt = mean(rt.log, na.rm = T),
              prop_correct = correct[1]/8) %>%
    filter(!is.na(groupCompare))

ggplot(k, aes(y=edits, x = likable)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("likability vs. edits") +
  stat_smooth(method = "lm") +
  annotate("text", x=2, y=.5, color = "red", size = 7,
          label=paste("r=", round(cor(k$likable, k$edits), 2))) +
  themeML 

ggplot(k, aes(y=edits, x = likable)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("likability vs. edits") +
  stat_smooth(method = "lm") +
  facet_grid(.~groupCompare) +
  themeML 

ggplot(k, aes(y=edits, x = howWell)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("workability vs. edits") +
  stat_smooth(method = "lm") +
  annotate("text", x=2, y=.5, color = "red", size = 7,
          label=paste("r=", round(cor(k$howWell, k$edits), 2))) +
  themeML 

ggplot(k, aes(y=edits, x = howWell)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("workability vs. edits") +
  stat_smooth(method = "lm") +
  facet_grid(.~groupCompare) +
  themeML 

ggplot(k, aes(y=rt, x = likable)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("likability vs. rt") +
  stat_smooth(method = "lm") +
  facet_grid(.~groupCompare) +
  themeML 

ggplot(k, aes(y=rt, x = howWell)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("workability vs. rt") +
  stat_smooth(method = "lm") +
  facet_grid(.~groupCompare) +
  themeML 

ggplot(k, aes(y=prop_correct, x = likable)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("likability vs. prop_correct") +
  stat_smooth(method = "lm") +
  annotate("text", x=2, y=.5, color = "red", size = 7,
          label=paste("r=", round(cor(k$likable, k$prop_correct), 2))) +
  themeML 

ggplot(k, aes(y=prop_correct, x = likable)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("likability vs. prop_correct") +
  stat_smooth(method = "lm") +
  facet_grid(.~groupCompare) +
  themeML 

ggplot(k, aes(y=prop_correct, x = howWell)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("workability vs. prop_correct") +
  stat_smooth(method = "lm") +
  annotate("text", x=2, y=.5, color = "red", size = 7,
          label=paste("r=", round(cor(k$howWell, k$prop_correct), 2))) +
  themeML 

ggplot(k, aes(y=prop_correct, x = howWell)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("workability vs. prop_correct") +
  stat_smooth(method = "lm") +
  facet_grid(.~groupCompare) +
  themeML 

social variables predict edits controling for rt

summary(lm(edits~rt + howWell, k))
## 
## Call:
## lm(formula = edits ~ rt + howWell, data = k)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.91473 -0.64921 -0.01793  0.51629  2.35387 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 10.50052    1.20223   8.734 9.72e-14 ***
## rt          -0.92533    0.15877  -5.828 8.01e-08 ***
## howWell     -0.26920    0.05423  -4.964 3.11e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8818 on 93 degrees of freedom
## Multiple R-squared:  0.5015, Adjusted R-squared:  0.4907 
## F-statistic: 46.77 on 2 and 93 DF,  p-value: 8.766e-15
summary(lm(edits~rt + likable, k))
## 
## Call:
## lm(formula = edits ~ rt + likable, data = k)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.22854 -0.79093  0.04559  0.76299  2.20735 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 11.92000    1.27711   9.334 5.26e-15 ***
## rt          -1.13880    0.16597  -6.862 7.46e-10 ***
## likable     -0.13416    0.06217  -2.158   0.0335 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.9678 on 93 degrees of freedom
## Multiple R-squared:  0.3994, Adjusted R-squared:  0.3865 
## F-statistic: 30.93 on 2 and 93 DF,  p-value: 5.045e-11
summary(lm(prop_correct~rt + likable, k))
## 
## Call:
## lm(formula = prop_correct ~ rt + likable, data = k)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.38904 -0.16872 -0.03556  0.14012  0.63938 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -1.43209    0.29192  -4.906 3.95e-06 ***
## rt           0.20062    0.03794   5.288 8.15e-07 ***
## likable      0.02224    0.01421   1.565    0.121    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2212 on 93 degrees of freedom
## Multiple R-squared:  0.2799, Adjusted R-squared:  0.2644 
## F-statistic: 18.08 on 2 and 93 DF,  p-value: 2.333e-07


All analyses with task demands exclusions

# get rid of people who guessed manipulation
#write.csv(d[d$phase == "QUESTIONNAIRE",c("workerID", "anythingOdd", "whatAbout")], "oddcheck.csv")
odds = read.csv("/Documents/GRADUATE_SCHOOL/Projects/likeSpeak/experiment/psiturk_likespeak/oddcheck_4.csv")
d = d %>%
    left_join(odds, by="workerID") %>%
    filter(Include == 1)

Likeability ratings

ggplot(d[!is.na(d$likableRating),], aes(x=as.factor(likableRating), 
                                        fill = condition)) +
  geom_bar(position="dodge") +
  ggtitle("Likeability") +
  xlab("rating") +
  ylim(0,7) +
  themeML                 

Likeability ratings by condition

likable = d %>%
  filter(phase == "QUESTIONNAIRE" & !is.na(likableRating)) %>%
  multi_boot(column="likableRating",
              summary_groups = c("condition"),
              statistics_functions = c("mean", "ci_lower","ci_upper"))

ggplot(likable, aes(y=mean, x = condition)) +
  geom_bar(position="dodge", stat="identity", fill = "red") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ggtitle("Likeability") +
  ylim(0,7) +
  themeML          

Likeability ratings by condition

likable = d %>%
  filter(phase == "QUESTIONNAIRE" & !is.na(likableRating)) %>%
  multi_boot(column="likableRating",
              summary_groups = c("groupCompare", "condition"),
              statistics_functions = c("mean", "ci_lower","ci_upper"))

ggplot(likable, aes(y=mean, x = groupCompare, fill=condition)) +
  geom_bar(position="dodge", stat="identity") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ggtitle("Likeability") +
  ylim(0,7) +
  themeML          

Workability ratings

ggplot(d[!is.na(d$howWellRating),], aes(x=as.factor(howWellRating), fill = condition)) +
  geom_bar(position="dodge") +  
  ggtitle("How well worked together") +
  xlab("rating") +
  ylim(0,10) +
  themeML                 

Workability ratings by condition

workable = d %>%
  filter(phase == "QUESTIONNAIRE" & !is.na(howWellRating)) %>%
  multi_boot(column="howWellRating",
                summary_groups = c("condition"),
                statistics_functions = c("mean", "ci_lower","ci_upper"))

ggplot(workable, aes(y=mean, x = condition)) +
  geom_bar(position="dodge", stat="identity", fill = "red") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ggtitle("How well worked together") +
  ylim(0,7) +
  themeML                 

Workability ratings by condition

workable = d %>%
  filter(phase == "QUESTIONNAIRE" & !is.na(howWellRating)) %>%
  multi_boot(column="howWellRating",
                summary_groups = c("groupCompare", "condition"),
                statistics_functions = c("mean", "ci_lower","ci_upper"))

ggplot(workable, aes(y=mean, x = groupCompare, fill = condition)) +
  geom_bar(position="dodge", stat="identity") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ggtitle("How well worked together") +
  ylim(0,7) +
  themeML                 

Edit distances

for (i in 1:dim(d)[1]){
      d$lev2[i] = adist(d$word[i], d$guessedLabel[i])
      d$ins[i] = drop(attr(adist(d$word[i], d$guessedLabel[i], counts = T), "counts"))[1]
      d$del[i] = drop(attr(adist(d$word[i], d$guessedLabel[i], counts = T), "counts"))[2]
      d$sub[i] = drop(attr(adist(d$word[i], d$guessedLabel[i], counts = T), "counts"))[3]
}

ggplot(d, aes(x=lev2, fill = condition)) +
  geom_bar(position="dodge", binwidth = 1) +  
  ggtitle("Edit distance") +
  xlab("edit distance") +
  themeML  

ggplot(d, aes(x=sub, fill = condition)) +
  geom_bar(position="dodge", binwidth = 1) +  
  ggtitle("substitutions") +
  xlab("substitutions") +
  themeML  

led = d %>%
        group_by(condition)  %>%
        filter(phase == "TEST" & !is.na(lev2))  %>%
        multi_boot(column="lev2",
                      summary_groups = c("condition"),
                      statistics_functions = c("mean", "ci_lower","ci_upper"))
        
ggplot(led, aes(y=mean, x = condition)) +
  geom_bar(position="dodge", stat="identity", fill = "red") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ylim(0,6) +
  ggtitle("Levenshtein edit distance") +
  themeML 

led = d %>%
        filter(phase == "TEST" & !is.na(lev2))  %>%
        multi_boot(column="lev2",
                    summary_groups = c("groupCompare", "condition"),
                    statistics_functions = c("mean", "ci_lower","ci_upper"))
        
ggplot(led, aes(y=mean, x = groupCompare, fill = condition)) +
  geom_bar(position="dodge", stat="identity") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ylim(0,4) +
  ggtitle("Levenshtein edit distance") +
  themeML 

subs = d %>%
        filter(phase == "TEST" & !is.na(lev2))  %>%
        multi_boot(column="sub",
                    summary_groups = c("groupCompare", "condition"),
                    statistics_functions = c("mean", "ci_lower","ci_upper"))
        
ggplot(subs, aes(y=mean, x = groupCompare, fill = condition)) +
  geom_bar(position="dodge", stat="identity") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ylim(0,4) +
  ggtitle("substitutions") +
  themeML 

RTs

d$rt.log = log(d$rt)

rts = d %>%
        filter(!is.na(rt.log))  %>%
        multi_boot(column="rt.log",
                    summary_groups = c("groupCompare", "condition"),
                    statistics_functions = c("mean", "ci_lower","ci_upper"))


ggplot(rts, aes(y=mean, x = groupCompare, fill = "condition")) +
  geom_bar(position="dodge", stat="identity", fill = "red") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ggtitle("RTS") +
  ylim(0,10) +
  themeML 

Accuracy by condition

acc = d %>%
        group_by(workerID, condition)  %>%
        filter(!is.na(accuracy))  %>%
        mutate(correct = length(which(accuracy == "correct"))) %>%
        summarise(prop_correct = correct[1]/8) %>%
        multi_boot(column="prop_correct",
                    summary_groups = c("condition"),
                    statistics_functions = c("mean", "ci_lower","ci_upper"))


ggplot(acc, aes(y=mean, x = condition)) +
  geom_bar(position="dodge", stat="identity", fill = "red") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ylim(0,1) +
  ggtitle("Accuracy") +
  themeML 

Accuracy by condition

acc = d %>%
        group_by(workerID, groupCompare, condition)  %>%
        filter(!is.na(accuracy))  %>%
        mutate(correct = length(which(accuracy == "correct"))) %>%
        summarise(prop_correct = correct[1]/8) %>%
        multi_boot(column="prop_correct",
                    summary_groups = c("groupCompare", "condition"),
                    statistics_functions = c("mean", "ci_lower","ci_upper"))


ggplot(acc, aes(y=mean, x = groupCompare, fill = condition)) +
  geom_bar(position="dodge", stat="identity") +  
  geom_errorbar(aes(ymin = ci_lower, ymax= ci_upper), 
                width=0.2, position="dodge") +
  ylim(0,1) +
  ggtitle("Accuracy") +
  themeML 

#write.csv(d[d$phase == "TEST",c("workerID", "word", "guessedLabel")], "wordfilter.csv")

Correlation between likeability and number of edits

d = d %>%
    group_by(workerID) %>%
    mutate(likableRating = likableRating[!is.na(likableRating)],
            howWellRating = howWellRating[!is.na(howWellRating)])

k = d %>%
    group_by(workerID, condition, groupCompare) %>%
    mutate(correct = length(which(accuracy == "correct"))) %>%
    summarise(edits = mean(lev2, na.rm = T),
              likable = mean(likableRating),
              howWell = mean(howWellRating),
              rt = mean(rt.log, na.rm = T),
              prop_correct = correct[1]/8) %>%
    filter(!is.na(groupCompare))

ggplot(k, aes(y=edits, x = likable)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("likability vs. edits") +
  stat_smooth(method = "lm") +
  annotate("text", x=2, y=1, color = "red", size = 7,
          label=paste("r=", round(cor(k$likable, k$edits), 2))) +
  themeML 

ggplot(k, aes(y=edits, x = likable)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("likability vs. edits") +
  stat_smooth(method = "lm") +
  facet_grid(.~groupCompare) +
  themeML 

ggplot(k, aes(y=edits, x = howWell)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("workability vs. edits") +
  stat_smooth(method = "lm") +
  annotate("text", x=2, y=1, color = "red", size = 7,
          label=paste("r=", round(cor(k$howWell, k$edits), 2))) +
  themeML 

ggplot(k, aes(y=edits, x = howWell)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("workability vs. edits") +
  stat_smooth(method = "lm") +
  facet_grid(.~groupCompare) +
  themeML 

ggplot(k, aes(y=rt, x = likable)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("likability vs. rt") +
  stat_smooth(method = "lm") +
  facet_grid(.~groupCompare) +
  themeML 

ggplot(k, aes(y=rt, x = howWell)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("workability vs. rt") +
  stat_smooth(method = "lm") +
  facet_grid(.~groupCompare) +
  themeML 

ggplot(k, aes(y=prop_correct, x = likable)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("likability vs. prop_correct") +
  stat_smooth(method = "lm") +
  annotate("text", x=2, y=.5, color = "red", size = 7,
          label=paste("r=", round(cor(k$likable, k$prop_correct), 2))) +
  themeML 

ggplot(k, aes(y=prop_correct, x = likable)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("likability vs. prop_correct") +
  stat_smooth(method = "lm") +
  facet_grid(.~groupCompare) +
  themeML 

ggplot(k, aes(y=prop_correct, x = howWell)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("workability vs. prop_correct") +
  stat_smooth(method = "lm") +
  annotate("text", x=2, y=.5, color = "red", size = 7,
          label=paste("r=", round(cor(k$howWell, k$prop_correct), 2))) +
  themeML 

ggplot(k, aes(y=prop_correct, x = howWell)) +
  geom_point(position="dodge", stat="identity") +  
  ggtitle("workability vs. prop_correct") +
  stat_smooth(method = "lm") +
  facet_grid(.~groupCompare) +
  themeML 

social variables predict edits controling for rt

summary(lm(edits~rt + howWell, k))
## 
## Call:
## lm(formula = edits ~ rt + howWell, data = k)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.93241 -0.72104 -0.04194  0.59291  2.33234 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 10.28818    1.48733   6.917 3.46e-09 ***
## rt          -0.90050    0.19631  -4.587 2.34e-05 ***
## howWell     -0.25954    0.06969  -3.724 0.000435 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.9342 on 60 degrees of freedom
## Multiple R-squared:  0.4567, Adjusted R-squared:  0.4386 
## F-statistic: 25.22 on 2 and 60 DF,  p-value: 1.127e-08
summary(lm(edits~rt + likable, k))
## 
## Call:
## lm(formula = edits ~ rt + likable, data = k)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.23605 -0.84207  0.08484  0.73183  2.21141 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 11.27367    1.57474   7.159 1.34e-09 ***
## rt          -1.04003    0.20585  -5.052 4.36e-06 ***
## likable     -0.16107    0.08298  -1.941    0.057 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.006 on 60 degrees of freedom
## Multiple R-squared:  0.3706, Adjusted R-squared:  0.3496 
## F-statistic: 17.66 on 2 and 60 DF,  p-value: 9.286e-07
summary(lm(prop_correct~rt + likable, k))
## 
## Call:
## lm(formula = prop_correct ~ rt + likable, data = k)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.40633 -0.16934 -0.03263  0.11613  0.64382 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -1.39441    0.36640  -3.806 0.000334 ***
## rt           0.19249    0.04790   4.019 0.000166 ***
## likable      0.02896    0.01931   1.500 0.138838    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.234 on 60 degrees of freedom
## Multiple R-squared:  0.2695, Adjusted R-squared:  0.2451 
## F-statistic: 11.07 on 2 and 60 DF,  p-value: 8.113e-05