1 Set up R environment

library(tidyverse)
library(ggplot2)
library(ggpubr)
library(plyr)

Set the R working drectory to the main experiment directory.

setwd("/Users/adambarnas/Box/Predicting_IB")  

2 Read-in datafiles

Read in the individual subject files.

Get a count of the number of subjects.

nrow(tbl_all %>% distinct(ID,.keep_all = FALSE))
## [1] 127

3 Matching task

3.1 Organize data

tbl_all_simple = subset(tbl_all, select = -c(rowNo,responseWindow,presTime,ISI,ITI,stimFormat,button1,keyboard,key,responseType,randomPick,responseOptions,pageBreak,required,if.,then,ITI_ms,ITI_f,ITI_fDuration,presTime_ms,presTime_f,presTime_fDuration,timestamp,responseCode,correct))

tbl_all_simple <- tbl_all_simple %>% 
  separate(response,into=c('response'))

tbl_all_simple <- tbl_all_simple %>% 
  separate(RTkeys,into=c('RTkeys'))

tbl_all_simple[tbl_all_simple==""]<-NA

tbl_all_simple$rt<- tbl_all_simple$RTkeys
tbl_all_simple$rt[is.na(tbl_all_simple$rt)] <- tbl_all_simple$RT[is.na(tbl_all_simple$rt)]

tbl_all_simple$rt  <- as.numeric(tbl_all_simple$rt)
tbl_all_simple$ID  <- as.character(tbl_all_simple$ID)
tbl_all_simple$stim1  <- as.character(tbl_all_simple$stim1)

tbl_all_blank_removed <- tbl_all_simple %>% 
  filter(stim1 != "blank")

tbl_all_matching <- tbl_all_blank_removed %>% 
  filter(grepl('matching', stim1))

tbl_all_matching[tbl_all_matching== "matching_prompt" ] <- NA
tbl_all_matching[tbl_all_matching== "timeout" ] <- NA

tbl_all_matching <- tbl_all_matching %>% 
  group_by(ID) %>% 
  fill(stim1) %>% #default direction down
  fill(stim1, .direction = "up")

tbl_all_matching_condensed <- tbl_all_matching %>% 
  group_by(ID, stim1) %>% 
  dplyr::summarise(RT = sum(rt), response = first(na.omit(response)))

Split up stim1 nomenclature to task, answer, and number.

tbl_all_matching_condensed <- tbl_all_matching_condensed %>%
  separate(stim1,into=c('task', 'answer', 'number'))

3.2 Accuracy

3.2.1 Analyze

In the matching figures task, subjects were instructed to press ‘F’ if the two complex shapes were the same and ‘J’ if the two complex shapes were different. Trials will be labeled 1 for correct responses (‘F’ for same objects and ‘J’ for different objects) and 0 for incorrect responses (‘F’ for different objects and ‘J’ for same objects).

tbl_all_matching_condensed$acc = "filler"

for (i in 1:length(tbl_all_matching_condensed$ID)){
  if (tbl_all_matching_condensed$task[i] == "matching"){
    if (tbl_all_matching_condensed$answer[i] == "same"){
      if (tbl_all_matching_condensed$response[i] == "f"){
        tbl_all_matching_condensed$acc[i] = 1
    } else {
        tbl_all_matching_condensed$acc[i] = 0
    }
    } else {
      if (tbl_all_matching_condensed$response[i] == "j"){
        tbl_all_matching_condensed$acc[i] = 1
    } else {
        tbl_all_matching_condensed$acc[i] = 0
    }
  }
  }
}

write.csv(tbl_all_matching_condensed,'matching_v3.csv', row.names=FALSE)

3.2.2 Plot

tbl_all_matching_condensed_acc <- tbl_all_matching_condensed %>%
  group_by(ID,task,acc) %>%
  dplyr::summarize(counts = n()) %>%
  spread(acc,counts) %>% 
  mutate(total = rowSums(.[3:4], na.rm = TRUE))
colnames(tbl_all_matching_condensed_acc) <- c("ID", "task", "inacc", "acc", "total")
tbl_all_matching_condensed_acc[is.na(tbl_all_matching_condensed_acc)] <- 0
tbl_all_matching_condensed_acc$rate <- tbl_all_matching_condensed_acc$acc / tbl_all_matching_condensed_acc$total

tbl_all_matching_condensed_acc %>%
  ggbarplot("ID", "rate", fill = "task", color = "task", palette = c("#0d2240", "#00a8e1"), font.xtickslab = 4, ylab = "Accuracy", ylim = c(0, 1), position = position_dodge(0.8)) + rotate_x_text() + geom_hline(yintercept = .5, linetype = 2) + theme(legend.position = "none")

tbl_all_matching_condensed_acc %>%
  ggbarplot("task", "rate", add = "mean_se",fill = "task", color = "task", palette = c("#0d2240", "#00a8e1"), ylab = "Accuracy", ylim = c(0, 1), position = position_dodge(0.8), label = TRUE, lab.vjust = -1, lab.nb.digits = 2) + geom_hline(yintercept = .5, linetype = 2) + theme(legend.position = "none")

matching_chance <- tbl_all_matching_condensed_acc %>% 
  filter(task =="matching")
matching_chance <-t.test(matching_chance$rate, mu = .50, alternative="greater")
matching_chance
## 
##  One Sample t-test
## 
## data:  matching_chance$rate
## t = 19.425, df = 126, p-value < 2.2e-16
## alternative hypothesis: true mean is greater than 0.5
## 95 percent confidence interval:
##  0.7209316       Inf
## sample estimates:
## mean of x 
## 0.7415354

3.2.3 Remove subjects below chance and replot

tbl_all_matching_condensed_acc <- subset(tbl_all_matching_condensed_acc, select = c(ID, task, rate))
tbl_all_matching_condensed_acc_wide <- tbl_all_matching_condensed_acc %>%
  spread(task,rate)

tbl_all_matching_condensed_acc <- tbl_all_matching_condensed_acc_wide %>% 
  filter(matching > 0.5)

tbl_all_matching_condensed_acc <- gather(tbl_all_matching_condensed_acc, task, rate, matching, factor_key=TRUE)

tbl_all_matching_condensed_acc %>%
  ggbarplot("ID", "rate", fill = "task", color = "task", palette = c("#0d2240", "#00a8e1"), font.xtickslab = 4, ylab = "Accuracy", ylim = c(0, 1), position = position_dodge(0.8)) + rotate_x_text() + geom_hline(yintercept = .5, linetype = 2) + theme(legend.position = "none")

tbl_all_matching_condensed_acc %>%
  ggbarplot("task", "rate", add = "mean_se",fill = "task", color = "task", palette = c("#0d2240", "#00a8e1"), ylab = "Accuracy", ylim = c(0, 1), position = position_dodge(0.8), label = TRUE, lab.vjust = -1, lab.nb.digits = 2) + geom_hline(yintercept = .5, linetype = 2) + theme(legend.position = "none")

matching_chance <- tbl_all_matching_condensed_acc %>% 
  filter(task =="matching")
matching_chance <-t.test(matching_chance$rate, mu = .50, alternative="greater")
matching_chance
## 
##  One Sample t-test
## 
## data:  matching_chance$rate
## t = 24.103, df = 117, p-value < 2.2e-16
## alternative hypothesis: true mean is greater than 0.5
## 95 percent confidence interval:
##  0.7454295       Inf
## sample estimates:
## mean of x 
## 0.7635593

3.2.4 Count subjects

nrow(tbl_all_matching_condensed_acc %>% distinct(ID,.keep_all = FALSE))
## [1] 118

3.3 RTs

3.3.1 Plot

tbl_all_matching_condensed_rts <- tbl_all_matching_condensed[(tbl_all_matching_condensed$ID %in% tbl_all_matching_condensed_acc$ID),] %>% 
  filter(acc == 1)

tbl_all_matching_condensed_rts %>%
  ggbarplot("ID", "RT", fill = "task", color = "task", palette = c("#0d2240", "#00a8e1"), font.xtickslab = 4, add = "median", position = position_dodge(0.8), ylab = "Median RT (ms)", ylim = c(0,7000)) + rotate_x_text() + theme(legend.position = "none") + geom_hline(yintercept = 200, linetype = 2)

tbl_all_matching_condensed_rts %>%
  ggbarplot("task", "RT", add = "median",fill = "task", color = "task", palette = c("#0d2240", "#00a8e1"), position = position_dodge(0.8), order = c("embedded", "matching"), ylab = "Median RT (ms)", ylim = c(0,4000), label = TRUE, lab.vjust = -1, lab.nb.digits = 2) + theme(legend.position = "none")

tbl_all_matching_condensed_rts_median <- tbl_all_matching_condensed_rts %>%
  group_by(ID,task) %>%
  dplyr::summarize(median_rt = median(RT, na.rm=TRUE))

3.3.2 Remove subjects with median RT below 200 ms and replot

tbl_all_matching_condensed_rts_median_200ms_removed <- tbl_all_matching_condensed_rts_median %>% 
  filter(median_rt > 200)

tbl_all_matching_condensed_rts_200ms_removed <- tbl_all_matching_condensed_rts[(tbl_all_matching_condensed_rts$ID %in% tbl_all_matching_condensed_rts_median_200ms_removed$ID),]

tbl_all_matching_condensed_rts_200ms_removed %>%
  ggbarplot("ID", "RT", fill = "task", color = "task", palette = c("#0d2240", "#00a8e1"), font.xtickslab = 4, add = "median", position = position_dodge(0.8), ylab = "Median RT (ms)", ylim = c(0,7000)) + rotate_x_text() + theme(legend.position = "none") + geom_hline(yintercept = 200, linetype = 2)

tbl_all_matching_condensed_rts_200ms_removed %>%
  ggbarplot("task", "RT", add = "median",fill = "task", color = "task", palette = c("#0d2240", "#00a8e1"), position = position_dodge(0.8), order = c("embedded", "matching"), ylab = "Median RT (ms)", ylim = c(0,4000), label = TRUE, lab.vjust = -1, lab.nb.digits = 2) + theme(legend.position = "none")

3.3.3 Count subjects

nrow(tbl_all_matching_condensed_rts_200ms_removed %>% distinct(ID,.keep_all = FALSE))
## [1] 113

4 IB performance

tbl_all <- tbl_all[(tbl_all$ID %in% tbl_all_matching_condensed_rts_median_200ms_removed$ID),]

tbl_all_IB <- tbl_all %>% 
  filter(grepl('Did you notice|item', head))
tbl_all_IB = subset(tbl_all_IB, select = -c(stim1,stim2,stim3,stim4,stim5,stim6,stim7,ITI,ISI,presTime,if.,then,presTime_ms,presTime_f,presTime_fDuration,RTkeys,correct,stimFormat,button1,keyboard,key,responseWindow,randomBlock,responseType,randomPick,responseOptions,pageBreak,required,ITI_ms,ITI_f,ITI_fDuration,responseCode))

tbl_all_IB <- tbl_all_IB[(tbl_all_IB$ID %in% tbl_all_matching_condensed_rts_median$ID),]

nrow(tbl_all_IB %>% distinct(ID,.keep_all = FALSE))
## [1] 113

4.1 Line judgment task

tbl_all_line <- tbl_all %>% 
  filter(rowNo >= 205 & rowNo <= 220)
tbl_all_line = subset(tbl_all_line, select = -c(rowNo,type,stim1,stim2,stim3,stim4,stim6,stim7,timestamp,RT,correct,ISI,ITI,stimFormat,button1,keyboard,key,responseWindow,randomBlock,presTime,head,responseType,randomPick,responseOptions,pageBreak,required,if.,then,ITI_ms,ITI_f,ITI_fDuration,presTime_ms,presTime_f,presTime_fDuration,RTkeys,responseCode,responseOptionsRandom))

tbl_all_line <- tbl_all_line[(tbl_all_line$ID %in% tbl_all_matching_condensed_rts_median$ID),]

tbl_all_line <- tbl_all_line %>%
  separate(stim5,into=c('longer_line', 'type', 'per_similar'),sep = "([\\_])")

tbl_all_line$acc = "filler"

for (i in 1:length(tbl_all_line$ID)){
    if (tbl_all_line$longer_line[i] == "vertical"){
      if (tbl_all_line$response[i] == "v"){
        tbl_all_line$acc[i] = 1
    } else {
        tbl_all_line$acc[i] = 0
    }
    } else {
      if (tbl_all_line$response[i] == "h"){
        tbl_all_line$acc[i] = 1
    } else {
        tbl_all_line$acc[i] = 0
    }
  }
}

tbl_all_line_acc <- tbl_all_line %>%
  group_by(ID,acc) %>%
  dplyr::summarize(counts = n()) %>%
  spread(acc,counts) %>% 
  mutate(total = rowSums(.[2:3], na.rm = TRUE))
colnames(tbl_all_line_acc) <- c("ID", "inacc", "acc", "total")
tbl_all_line_acc[is.na(tbl_all_line_acc)] <- 0
tbl_all_line_acc$rate <- tbl_all_line_acc$acc / tbl_all_line_acc$total

tbl_all_line_acc %>%
  ggbarplot("ID", "rate", fill = "#0d2240", color = "#0d2240", font.xtickslab = 4, ylab = "Accuracy", ylim = c(0, 1), position = position_dodge(0.8)) + rotate_x_text() + geom_hline(yintercept = .5, linetype = 2)

tbl_all_line_acc %>%
  ggbarplot(y = "rate", add = "mean_se",fill = "#0d2240", color = "#0d2240", ylab = "Accuracy", ylim = c(0, 1), position = position_dodge(0.8), label = TRUE, lab.vjust = -1.5, lab.nb.digits = 2) + geom_hline(yintercept = .5, linetype = 2)

all_line_chance <-t.test(tbl_all_line_acc$rate, mu = .50, alternative="greater")
all_line_chance
## 
##  One Sample t-test
## 
## data:  tbl_all_line_acc$rate
## t = 7.9518, df = 112, p-value = 8.018e-13
## alternative hypothesis: true mean is greater than 0.5
## 95 percent confidence interval:
##  0.6505804       Inf
## sample estimates:
## mean of x 
## 0.6902655
write.csv(tbl_all_line,'line_judgment_v3.csv', row.names=FALSE)

4.2 Remove subjects who missed catch trials

tbl_all_line_good_catch <- tbl_all_line %>%
  group_by(ID) %>% 
  filter(!any(type == "catch" & acc == 0))

tbl_all_line_acc_good_catch <- tbl_all_line_good_catch %>%
  group_by(ID,acc) %>%
  dplyr::summarize(counts = n()) %>%
  spread(acc,counts) %>% 
  mutate(total = rowSums(.[2:3], na.rm = TRUE))
colnames(tbl_all_line_acc_good_catch) <- c("ID", "inacc", "acc", "total")
tbl_all_line_acc_good_catch[is.na(tbl_all_line_acc_good_catch)] <- 0
tbl_all_line_acc_good_catch$rate <- tbl_all_line_acc_good_catch$acc / tbl_all_line_acc_good_catch$total

tbl_all_line_acc_good_catch %>%
  ggbarplot("ID", "rate", fill = "#0d2240", color = "#0d2240", font.xtickslab = 4, ylab = "Accuracy", ylim = c(0, 1), position = position_dodge(0.8)) + rotate_x_text() + geom_hline(yintercept = .5, linetype = 2)

tbl_all_line_acc_good_catch %>%
  ggbarplot(y = "rate", add = "mean_se",fill = "#0d2240", color = "#0d2240", ylab = "Accuracy", ylim = c(0, 1), position = position_dodge(0.8), label = TRUE, lab.vjust = -1.5, lab.nb.digits = 2) + geom_hline(yintercept = .5, linetype = 2)

all_line_chance <-t.test(tbl_all_line_acc_good_catch$rate, mu = .50, alternative="greater")
all_line_chance
## 
##  One Sample t-test
## 
## data:  tbl_all_line_acc_good_catch$rate
## t = 18.028, df = 64, p-value < 2.2e-16
## alternative hypothesis: true mean is greater than 0.5
## 95 percent confidence interval:
##  0.8110053       Inf
## sample estimates:
## mean of x 
##  0.842735

4.2.1 Count subjects

nrow(tbl_all_line_acc_good_catch %>% distinct(ID,.keep_all = FALSE))
## [1] 65

4.3 Noticers vs. Non-noticers

tbl_all_IB <- tbl_all_IB[(tbl_all_IB$ID %in% tbl_all_line_acc_good_catch$ID),]

tbl_all_notice <- tbl_all_IB %>% 
  filter(grepl('shapes', head))
tbl_all_notice = subset(tbl_all_notice, select = -c(rowNo,type,head,timestamp,RT,responseOptionsRandom))

tbl_all_notice$notice_shape = "filler"

for (i in 1:length(tbl_all_notice$ID)){
    if (tbl_all_notice$response[i] == "Square" | tbl_all_notice$response[i] == "Circle" | tbl_all_notice$response[i] == "Triangle"){
        tbl_all_notice$notice_shape[i] = 1
    }
    else {
        tbl_all_notice$notice_shape[i] = 0
    }
}

tbl_all_notice$notice_square = "filler"

for (i in 1:length(tbl_all_notice$ID)){
    if (tbl_all_notice$response[i] == "Square"){
        tbl_all_notice$notice_square[i] = 1
    }
    else {
        tbl_all_notice$notice_square[i] = 0
    }
}

table(tbl_all_notice$response)
## 
##                               Circle I did not notice any of these shapes 
##                                    7                                   42 
##                               Square                             Triangle 
##                                   10                                    6
table(tbl_all_notice$notice_shape)
## 
##  0  1 
## 42 23
table(tbl_all_notice$notice_square)
## 
##  0  1 
## 55 10

4.4 Unexpected event location

tbl_all_line_unexpected <- tbl_all_line %>% 
  filter(type == "UR" | type == "UL" | type == "LL" | type == "LR")

tbl_all_line_unexpected <- tbl_all_line_unexpected[(tbl_all_line_unexpected$ID %in% tbl_all_notice$ID),]

tbl_all_notice<- cbind.data.frame(tbl_all_notice, tbl_all_line_unexpected[3])

tbl_all <- tbl_all[(tbl_all$ID %in% tbl_all_notice$ID),]

tbl_all_location <- tbl_all %>% 
  filter(grepl('located', head))

tbl_all_location = subset(tbl_all_location, select = c(ID,response))

tbl_all_notice <- merge(tbl_all_notice, tbl_all_location, by = "ID", all.x = TRUE, all.y = TRUE)

colnames(tbl_all_notice) <- c("ID", "notice_response", "notice_shape", "notice_square", "square_location", "location_response")

tbl_all_notice <- tbl_all_notice %>% mutate(location_response = recode_factor(location_response, `Upper left`="UL", `Upper right`="UR", `Lower left`="LL", `Lower right`="LR"))

tbl_all_notice$notice_square_and_location = "filler"

for (i in 1:length(tbl_all_notice$ID)){
  if (tbl_all_notice$notice_response[i] == "Square"){
    if (tbl_all_notice$square_location[i] == "UL"){
      if (tbl_all_notice$location_response[i] == "UL"){
        tbl_all_notice$notice_square_and_location[i] = 1
    } else {
        tbl_all_notice$notice_square_and_location[i] = 0
    }
    } else if (tbl_all_notice$square_location[i] == "UR"){
      if (tbl_all_notice$location_response[i] == "UR"){
        tbl_all_notice$notice_square_and_location[i] = 1
    } else {
        tbl_all_notice$notice_square_and_location[i] = 0
    }
    } else if (tbl_all_notice$square_location[i] == "LL"){
      if (tbl_all_notice$location_response[i] == "LL"){
        tbl_all_notice$notice_square_and_location[i] = 1
    } else {
        tbl_all_notice$notice_square_and_location[i] = 0
    }
    } else if (tbl_all_notice$square_location[i] == "LR"){
      if (tbl_all_notice$location_response[i] == "LR"){
        tbl_all_notice$notice_square_and_location[i] = 1
    } else {
        tbl_all_notice$notice_square_and_location[i] = 0
    }
    }
  }
}

tbl_all_notice$notice_location = "filler"

for (i in 1:length(tbl_all_notice$ID)){
  if (tbl_all_notice$notice_response[i] == "Square" | tbl_all_notice$notice_response[i] == "Circle" | tbl_all_notice$notice_response[i] == "Triangle"){
    if (tbl_all_notice$square_location[i] == "UL"){
      if (tbl_all_notice$location_response[i] == "UL"){
        tbl_all_notice$notice_location[i] = 1
    } else {
        tbl_all_notice$notice_location[i] = 0
    }
    } else if (tbl_all_notice$square_location[i] == "UR"){
      if (tbl_all_notice$location_response[i] == "UR"){
        tbl_all_notice$notice_location[i] = 1
    } else {
        tbl_all_notice$notice_location[i] = 0
    }
    } else if (tbl_all_notice$square_location[i] == "LL"){
      if (tbl_all_notice$location_response[i] == "LL"){
        tbl_all_notice$notice_location[i] = 1
    } else {
        tbl_all_notice$notice_location[i] = 0
    }
    } else if (tbl_all_notice$square_location[i] == "LR"){
      if (tbl_all_notice$location_response[i] == "LR"){
        tbl_all_notice$notice_location[i] = 1
    } else {
        tbl_all_notice$notice_location[i] = 0
    }
    }
  }
}

tbl_all_notice[tbl_all_notice == "filler"] <- 0

write.csv(tbl_all_notice,'IB_v3.csv', row.names=FALSE)

5 Post IB questions

5.1 Expecting an unexpected event

tbl_all <- tbl_all[(tbl_all$ID %in% tbl_all_IB$ID),]

tbl_all_expecting <- tbl_all %>% 
  filter(grepl('Before', head))
tbl_all_expecting = subset(tbl_all_expecting, select = -c(stim1,ITI,ISI,presTime,if.,then,presTime_ms,presTime_f,presTime_fDuration,RTkeys,correct,stimFormat,button1,keyboard,key,responseWindow,randomBlock,responseType,randomPick,responseOptions,pageBreak,required,ITI_ms,ITI_f,ITI_fDuration,responseCode))

tbl_all_expecting <- tbl_all_expecting[(tbl_all_expecting$ID %in% tbl_all_matching_condensed_rts_median$ID),]

table(tbl_all_expecting$response)
## 
##  No Yes 
##  58   7

5.2 Familiarity with IB experiments

tbl_all_familiarity <- tbl_all %>% 
  filter(grepl('gorilla', head))
tbl_all_familiarity = subset(tbl_all_familiarity, select = -c(stim1,ITI,ISI,presTime,if.,then,presTime_ms,presTime_f,presTime_fDuration,RTkeys,correct,stimFormat,button1,keyboard,key,responseWindow,randomBlock,responseType,randomPick,responseOptions,pageBreak,required,ITI_ms,ITI_f,ITI_fDuration,responseCode))

tbl_all_familiarity <- tbl_all_familiarity[(tbl_all_familiarity$ID %in% tbl_all_matching_condensed_rts_median$ID),]

table(tbl_all_familiarity$response)
## 
##  No Yes 
##  44  21

6 Predicting IB

tbl_median_rts <- tbl_all_matching_condensed_rts_median_200ms_removed[(tbl_all_matching_condensed_rts_median_200ms_removed$ID %in% tbl_all_notice$ID),]

tbl_acc <- tbl_all_matching_condensed_acc[(tbl_all_matching_condensed_acc$ID %in% tbl_all_notice$ID),]

tbl_log_reg <- cbind.data.frame(tbl_all_notice, tbl_median_rts[3], tbl_acc[3])

tbl_log_reg$notice_shape <- as.numeric(tbl_log_reg$notice_shape)
tbl_log_reg$notice_square <- as.numeric(tbl_log_reg$notice_square)
tbl_log_reg$notice_square_and_location <- as.numeric(tbl_log_reg$notice_square_and_location)
tbl_log_reg$notice_location <- as.numeric(tbl_log_reg$notice_location)

6.1 Matching median RT

6.1.1 Notice shape

log_reg_matching_median_rt <- glm(notice_shape ~ median_rt, data = tbl_log_reg, family = binomial(link = "logit"))
summary(log_reg_matching_median_rt)
## 
## Call:
## glm(formula = notice_shape ~ median_rt, family = binomial(link = "logit"), 
##     data = tbl_log_reg)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.9622  -0.9434  -0.9212   1.4272   1.5151  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)
## (Intercept) -4.257e-01  8.555e-01  -0.498    0.619
## median_rt   -5.622e-05  2.605e-04  -0.216    0.829
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 84.473  on 64  degrees of freedom
## Residual deviance: 84.427  on 63  degrees of freedom
## AIC: 88.427
## 
## Number of Fisher Scoring iterations: 4
plot_matching_median_rt <- ggplot(tbl_log_reg, aes(x=median_rt, y=notice_shape)) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_matching_median_rt))

6.1.2 Notice correct location

log_reg_matching_median_rt <- glm(notice_location ~ median_rt, data = tbl_log_reg, family = binomial(link = "logit"))
summary(log_reg_matching_median_rt)
## 
## Call:
## glm(formula = notice_location ~ median_rt, family = binomial(link = "logit"), 
##     data = tbl_log_reg)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.5965  -0.5809  -0.5744  -0.5705   1.9598  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.805e+00  1.132e+00  -1.595    0.111
## median_rt    3.172e-05  3.402e-04   0.093    0.926
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 55.812  on 64  degrees of freedom
## Residual deviance: 55.803  on 63  degrees of freedom
## AIC: 59.803
## 
## Number of Fisher Scoring iterations: 3
plot_matching_median_rt <- ggplot(tbl_log_reg, aes(x=median_rt, y=notice_square)) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_matching_median_rt))

6.1.3 Notice square

log_reg_matching_median_rt <- glm(notice_square ~ median_rt, data = tbl_log_reg, family = binomial(link = "logit"))
summary(log_reg_matching_median_rt)
## 
## Call:
## glm(formula = notice_square ~ median_rt, family = binomial(link = "logit"), 
##     data = tbl_log_reg)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.7995  -0.6311  -0.5445  -0.3956   2.2781  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.3744064  1.1900836  -0.315    0.753
## median_rt   -0.0004434  0.0003972  -1.116    0.264
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 55.812  on 64  degrees of freedom
## Residual deviance: 54.420  on 63  degrees of freedom
## AIC: 58.42
## 
## Number of Fisher Scoring iterations: 5
plot_matching_median_rt <- ggplot(tbl_log_reg, aes(x=median_rt, y=notice_square)) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_matching_median_rt))

6.1.4 Notice square in correct location

log_reg_matching_median_rt <- glm(notice_square_and_location ~ median_rt, data = tbl_log_reg, family = binomial(link = "logit"))
summary(log_reg_matching_median_rt)
## 
## Call:
## glm(formula = notice_square_and_location ~ median_rt, family = binomial(link = "logit"), 
##     data = tbl_log_reg)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.5733  -0.4080  -0.3419  -0.2591   2.4428  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.8372659  1.8262761  -0.458    0.647
## median_rt   -0.0006518  0.0006529  -0.998    0.318
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 30.053  on 64  degrees of freedom
## Residual deviance: 28.872  on 63  degrees of freedom
## AIC: 32.872
## 
## Number of Fisher Scoring iterations: 6
plot_matching_median_rt <- ggplot(tbl_log_reg, aes(x=median_rt, y=notice_square_and_location)) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_matching_median_rt))

6.2 Matching accuracy

6.2.1 Notice shape

log_reg_matching_acc <- glm(notice_shape ~ rate, data = tbl_log_reg, family = binomial(link = "logit"))
summary(log_reg_matching_acc)
## 
## Call:
## glm(formula = notice_shape ~ rate, family = binomial(link = "logit"), 
##     data = tbl_log_reg)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.4521  -0.8798  -0.7051   1.2781   1.8168  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)  
## (Intercept)    4.924      2.532   1.945   0.0518 .
## rate          -6.877      3.149  -2.184   0.0290 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 84.473  on 64  degrees of freedom
## Residual deviance: 79.285  on 63  degrees of freedom
## AIC: 83.285
## 
## Number of Fisher Scoring iterations: 4
plot_matching_acc<- ggplot(tbl_log_reg, aes(x=rate, y=notice_shape)) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_matching_acc))

6.2.2 Notice correct location

log_reg_matching_acc <- glm(notice_location ~ rate, data = tbl_log_reg, family = binomial(link = "logit"))
summary(log_reg_matching_acc)
## 
## Call:
## glm(formula = notice_location ~ rate, family = binomial(link = "logit"), 
##     data = tbl_log_reg)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.7716  -0.6006  -0.5373  -0.4984   2.0723  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept)    0.868      2.986   0.291    0.771
## rate          -3.212      3.744  -0.858    0.391
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 55.812  on 64  degrees of freedom
## Residual deviance: 55.091  on 63  degrees of freedom
## AIC: 59.091
## 
## Number of Fisher Scoring iterations: 4
plot_matching_acc <- ggplot(tbl_log_reg, aes(x=rate, y=notice_square)) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_matching_acc))

6.2.3 Notice square

log_reg_matching_acc <- glm(notice_square ~ rate, data = tbl_log_reg, family = binomial(link = "logit"))
summary(log_reg_matching_acc)
## 
## Call:
## glm(formula = notice_square ~ rate, family = binomial(link = "logit"), 
##     data = tbl_log_reg)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.8629  -0.6058  -0.5163  -0.4632   2.1861  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept)    1.968      2.949   0.667    0.505
## rate          -4.607      3.731  -1.235    0.217
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 55.812  on 64  degrees of freedom
## Residual deviance: 54.309  on 63  degrees of freedom
## AIC: 58.309
## 
## Number of Fisher Scoring iterations: 4
plot_matching_acc<- ggplot(tbl_log_reg, aes(x=rate, y=notice_square)) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_matching_acc))

6.2.4 Notice square in correct location

log_reg_matching_acc <- glm(notice_square_and_location ~ rate, data = tbl_log_reg, family = binomial(link = "logit"))
summary(log_reg_matching_acc)
## 
## Call:
## glm(formula = notice_square_and_location ~ rate, family = binomial(link = "logit"), 
##     data = tbl_log_reg)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.5005  -0.3703  -0.3247  -0.2973   2.5065  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept)   0.1522     4.3162   0.035    0.972
## rate         -3.6103     5.4685  -0.660    0.509
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 30.053  on 64  degrees of freedom
## Residual deviance: 29.634  on 63  degrees of freedom
## AIC: 33.634
## 
## Number of Fisher Scoring iterations: 5
plot_matching_acc<- ggplot(tbl_log_reg, aes(x=rate, y=notice_square_and_location)) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_matching_acc))

6.3 Matching median RT and accuracy

6.3.1 Notice shape

log_reg_matching_median_rt_and_acc <- glm(notice_shape ~ median_rt + rate, data = tbl_log_reg, family = binomial(link = "logit"))
summary(log_reg_matching_median_rt_and_acc)
## 
## Call:
## glm(formula = notice_shape ~ median_rt + rate, family = binomial(link = "logit"), 
##     data = tbl_log_reg)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.4724  -0.8851  -0.6796   1.2357   1.8580  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)  
## (Intercept)  5.3076534  2.5839397   2.054   0.0400 *
## median_rt    0.0002977  0.0003087   0.965   0.3348  
## rate        -8.5237011  3.6533366  -2.333   0.0196 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 84.473  on 64  degrees of freedom
## Residual deviance: 78.350  on 62  degrees of freedom
## AIC: 84.35
## 
## Number of Fisher Scoring iterations: 4

6.3.2 Notice correct location

log_reg_matching_median_rt_and_acc <- glm(notice_location ~ median_rt + rate, data = tbl_log_reg, family = binomial(link = "logit"))
summary(log_reg_matching_median_rt_and_acc)
## 
## Call:
## glm(formula = notice_location ~ median_rt + rate, family = binomial(link = "logit"), 
##     data = tbl_log_reg)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.8565  -0.5998  -0.5407  -0.4624   2.1560  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)
## (Intercept)  1.1363911  3.0425684   0.373    0.709
## median_rt    0.0002190  0.0003877   0.565    0.572
## rate        -4.4118210  4.3700393  -1.010    0.313
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 55.812  on 64  degrees of freedom
## Residual deviance: 54.778  on 62  degrees of freedom
## AIC: 60.778
## 
## Number of Fisher Scoring iterations: 4

6.3.3 Notice square

log_reg_matching_median_rt_and_acc <- glm(notice_square ~ median_rt + rate, data = tbl_log_reg, family = binomial(link = "logit"))
summary(log_reg_matching_median_rt_and_acc)
## 
## Call:
## glm(formula = notice_square ~ median_rt + rate, family = binomial(link = "logit"), 
##     data = tbl_log_reg)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.9384  -0.6133  -0.5416  -0.4101   2.3304  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)
## (Intercept)  1.7260064  2.9732169   0.581    0.562
## median_rt   -0.0002917  0.0004383  -0.665    0.506
## rate        -3.2034088  4.2223005  -0.759    0.448
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 55.812  on 64  degrees of freedom
## Residual deviance: 53.843  on 62  degrees of freedom
## AIC: 59.843
## 
## Number of Fisher Scoring iterations: 4

6.3.4 Notice square in correct location

log_reg_matching_median_rt_and_acc <- glm(notice_square_and_location ~ median_rt + rate, data = tbl_log_reg, family = binomial(link = "logit"))
summary(log_reg_matching_median_rt_and_acc)
## 
## Call:
## glm(formula = notice_square_and_location ~ median_rt + rate, 
##     family = binomial(link = "logit"), data = tbl_log_reg)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.5995  -0.4079  -0.3475  -0.2596   2.4625  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.2870951  4.2998483  -0.067    0.947
## median_rt   -0.0006036  0.0007315  -0.825    0.409
## rate        -0.8643979  6.1654753  -0.140    0.889
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 30.053  on 64  degrees of freedom
## Residual deviance: 28.853  on 62  degrees of freedom
## AIC: 34.853
## 
## Number of Fisher Scoring iterations: 6