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/CogStyles_IB")  

2 Sona Subjects

2.1 Read-in datafiles

Read in the individual subject files (saved automatically on the server as csv files).

Get a count of the number of subjects.

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

2.2 Cognitive Styles

Split up the cognitive styles stimuli nomenclature to task, answer, and number. Filter the two cognitive styles tasks.

tbl_all_cog_style_sona <- tbl_all_sona %>%
  separate(stim1,into=c('task', 'answer', 'number')) %>% 
  filter(task == 'matching' | task == 'embedded')
tbl_all_cog_style_sona = subset(tbl_all_cog_style_sona, select = -c(ITI,stimFormat,button1,keyboard,key,responseWindow,head,responseType,randomPick,responseOptions,pageBreak,required,responseCode,correct))

2.2.1 Analyze accuracy

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).

In the embedded figures task, subjects were instructed to press ‘F’ if the simple shape is within the complex shape and ‘J’ if the the simple shape is not within the complex shape. Trials will be labeled 1 for correct responses (‘F’ for simple within complex and ‘J’ for simple not within complex) and 0 for incorrect responses (‘F’ simple not within complex and ‘J’ simple within complex).

tbl_all_cog_style_sona$acc = "filler"

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

2.2.2 Plot accuracy

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

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

tbl_all_cog_style_acc_sona %>%
  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)) + geom_hline(yintercept = .5, linetype = 2)

embedded_chance_sona <- tbl_all_cog_style_acc_sona %>% 
  filter(task =="embedded")
embedded_chance_sona <-t.test(embedded_chance_sona$rate, mu = .50, alternative="greater")
embedded_chance_sona
## 
##  One Sample t-test
## 
## data:  embedded_chance_sona$rate
## t = 15.597, df = 17, p-value = 8.324e-12
## alternative hypothesis: true mean is greater than 0.5
## 95 percent confidence interval:
##  0.8319395       Inf
## sample estimates:
## mean of x 
## 0.8736111
matching_chance_sona <- tbl_all_cog_style_acc_sona %>% 
  filter(task =="matching")
matching_chance_sona <-t.test(matching_chance_sona$rate, mu = .50, alternative="greater")
matching_chance_sona
## 
##  One Sample t-test
## 
## data:  matching_chance_sona$rate
## t = 14.77, df = 17, p-value = 1.978e-11
## alternative hypothesis: true mean is greater than 0.5
## 95 percent confidence interval:
##  0.8014245       Inf
## sample estimates:
## mean of x 
## 0.8416667
tbl_all_cog_style_acc_sona %>% 
  with(t.test(rate~task,paired=TRUE))
## 
##  Paired t-test
## 
## data:  rate by task
## t = 1.2023, df = 17, p-value = 0.2457
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.02411098  0.08799987
## sample estimates:
## mean of the differences 
##              0.03194444

2.2.3 Plot RTs

tbl_all_cog_style_rts_sona <- tbl_all_cog_style_sona %>%
  filter(acc == 1)

tbl_all_cog_style_rts_sona %>%
  ggbarplot("ID", "RT", fill = "task", color = "task", palette = c("#0d2240", "#00a8e1"), add = "median", position = position_dodge(0.8), ylab = "Median RT (ms)", ylim = c(0,8000)) + rotate_x_text()

tbl_all_cog_style_rts_sona %>%
  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,5000))

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

tbl_all_cog_style_rts_median_sona %>% 
  with(t.test(median_rt~task,paired=TRUE))
## 
##  Paired t-test
## 
## data:  median_rt by task
## t = -3.9182, df = 17, p-value = 0.001107
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -2848.1293  -854.4262
## sample estimates:
## mean of the differences 
##               -1851.278

2.2.4 Compute cognitive style ratio

The wholist-analytic ratio is calculated by dividing the median response latency to items in the matching figures task (wholist) by the median response latency to items in the embedded figures task (analytic) A ratio of below 1 indicates that an individual responded relatively faster to the matching figure items, corresponding to a wholist profile; a ratio of above 1 indicates that an individual responded relatively faster to the embedded figure items, corresponding to a analytic profile.

tbl_all_cog_style_rts_median_sona <- tbl_all_cog_style_rts_median_sona %>% 
  spread(task, median_rt)
tbl_all_cog_style_rts_median_sona$ratio <- tbl_all_cog_style_rts_median_sona$matching / tbl_all_cog_style_rts_median_sona$embedded

tbl_all_cog_style_rts_median_sona$style = "filler"
for (i in 1:length(tbl_all_cog_style_rts_median_sona$ID)){
  if (tbl_all_cog_style_rts_median_sona$ratio[i] > 1){
    tbl_all_cog_style_rts_median_sona$style[i] = "analytic"
  } else {
    tbl_all_cog_style_rts_median_sona$style[i] = "wholist"
  }
}

tbl_all_cog_style_rts_median_sona %>%
  ggbarplot("ID", "ratio", fill = "#f7a800", color = "#f7a800", ylim = c(0,5), ylab = "Median wholist-analytic ratio") + rotate_x_text() + geom_hline(yintercept = 1, linetype = 2)

table(tbl_all_cog_style_rts_median_sona$style)
## 
## analytic  wholist 
##       15        3

2.3 IB performance

tbl_all_IB_sona <- tbl_all_sona %>% 
  filter(grepl('Did you notice|item', head))
tbl_all_IB_sona = subset(tbl_all_IB_sona, select = -c(stim1,ITI,stimFormat,button1,keyboard,key,responseWindow,randomBlock,responseType,randomPick,responseOptions,pageBreak,required,ITI_ms,ITI_f,ITI_fDuration,responseCode))

2.3.1 Noticers vs. Non-noticers

tbl_all_notice_sona <- tbl_all_IB_sona %>% 
  filter(grepl('items', head))
table(tbl_all_notice_sona$response)
## 
##       No Not sure      Yes 
##        4        3       11

2.3.2 Unexpected event description

tbl_all_event_sona <- tbl_all_IB_sona %>% 
  filter(grepl('moved', head))
tbl_all_event_sona <- cbind.data.frame(tbl_all_event_sona[1], tbl_all_event_sona[6])
knitr::kable(tbl_all_event_sona)
ID response
205396 it was the plus sign (+) and it moved from the right hand side towards the left hand side of the screen.
205204 I noticed the plus sign moving across the screen. It moved from right to left across the center line.
205060 the plus sign, moved from right to left, down the horizontal line
205420 the + moves horizontally passing the center of the box.
205255 I feel like I saw the + a few times but did not pay attention to its movement
205189 Plus sign horizontally
205057 I might have seen a + sign but I don’t really remember.
204988 I think I saw + but I am not sure how it moved.
205315 Ts and Ls
205408 +
205051 n/a
204949 The cross on the right.
205306 I’m not sure, but the + might have moved with the letters.
205084 I didn’t see anything unusual
205324 I have no idea. Maybe the black letters were erased so we only had to focus on the white letters.
205225 the middle, plus sign
205429 The cross moved horizontally along the line that the letters were crossing.
205432 X

2.4 Post IB questions

2.4.1 Expecting an unexpected event

tbl_all_expecting_sona <- tbl_all_sona %>% 
  filter(grepl('Before', head))
tbl_all_expecting_sona = subset(tbl_all_expecting_sona, select = -c(stim1,ITI,stimFormat,button1,keyboard,key,responseWindow,randomBlock,responseType,randomPick,responseOptions,pageBreak,required,ITI_ms,ITI_f,ITI_fDuration,responseCode))

table(tbl_all_expecting_sona$response)
## 
##  No Yes 
##  14   4

2.4.2 Familiarity with IB experiments

tbl_all_familiarity_sona <- tbl_all_sona %>% 
  filter(grepl('gorilla', head))
tbl_all_familiarity_sona = subset(tbl_all_familiarity_sona, select = -c(stim1,ITI,stimFormat,button1,keyboard,key,responseWindow,randomBlock,responseType,randomPick,responseOptions,pageBreak,required,ITI_ms,ITI_f,ITI_fDuration,responseCode))

table(tbl_all_familiarity_sona$response)
## 
##  No Yes 
##   4  14

2.5 Cognitive style ratio predicting IB

2.5.1 Logistic regression (Continuous predictor, dichotomous outcome)

tbl_log_reg_sona <- merge(tbl_all_cog_style_rts_median_sona, tbl_all_notice_sona, by = "ID")
tbl_log_reg_sona = subset(tbl_log_reg_sona, select = -c(rowNo,type,head,timestamp,RT,correct))
tbl_log_reg_sona[tbl_log_reg_sona == "Yes"] <- 1
tbl_log_reg_sona[tbl_log_reg_sona == "No"] <- 0
tbl_log_reg_sona[tbl_log_reg_sona == "Not sure"] <- 0
names(tbl_log_reg_sona)[names(tbl_log_reg_sona)=="response"] <- "notice"
tbl_log_reg_sona$notice <- as.numeric(tbl_log_reg_sona$notice)

log_reg_sona <- glm(notice ~ ratio, data = tbl_log_reg_sona, family = binomial(link = "logit"))
summary(log_reg_sona)
## 
## Call:
## glm(formula = notice ~ ratio, family = binomial(link = "logit"), 
##     data = tbl_log_reg_sona)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.0053  -1.1672   0.6951   0.9812   1.2756  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept)  -0.6924     1.0666  -0.649    0.516
## ratio         0.5755     0.4983   1.155    0.248
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 24.057  on 17  degrees of freedom
## Residual deviance: 22.537  on 16  degrees of freedom
## AIC: 26.537
## 
## Number of Fisher Scoring iterations: 4

2.5.2 Plot

plot_sona <- ggplot(tbl_log_reg_sona, aes(x=ratio, y=notice)) + xlim(0,5) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_sona))

2.5.3 Logistic regression (Dichotomous predictor, dichotomous outcome)

log_reg_sona <- glm(notice ~ style, data = tbl_log_reg_sona, family = binomial)
summary(log_reg_sona)
## 
## Call:
## glm(formula = notice ~ style, family = binomial, data = tbl_log_reg_sona)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.4823  -1.3369   0.9005   0.9005   1.4823  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)
## (Intercept)    0.6931     0.5477   1.266    0.206
## stylewholist  -1.3863     1.3416  -1.033    0.301
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 24.057  on 17  degrees of freedom
## Residual deviance: 22.915  on 16  degrees of freedom
## AIC: 26.915
## 
## Number of Fisher Scoring iterations: 4

3 MTurk Subjects

3.1 Read-in datafiles

Read in the individual subject files (saved automatically on the server as csv files).

Get a count of the number of subjects.

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

3.2 Cognitive Styles

Split up the cognitive styles stimuli nomenclature to task, answer, and number. Filter the two cognitive styles tasks.

tbl_all_cog_style_mturk <- tbl_all_mturk %>%
  separate(stim1,into=c('task', 'answer', 'number')) %>% 
  filter(task == 'matching' | task == 'embedded')
tbl_all_cog_style_mturk = subset(tbl_all_cog_style_mturk, select = -c(ITI,stimFormat,button1,keyboard,key,responseWindow,head,responseType,randomPick,responseOptions,pageBreak,required,responseCode,correct))

3.2.1 Analyze accuracy

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).

In the embedded figures task, subjects were instructed to press ‘F’ if the simple shape is within the complex shape and ‘J’ if the the simple shape is not within the complex shape. Trials will be labeled 1 for correct responses (‘F’ for simple within complex and ‘J’ for simple not within complex) and 0 for incorrect responses (‘F’ simple not within complex and ‘J’ simple within complex).

tbl_all_cog_style_mturk$acc = "filler"

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

3.2.2 Plot accuracy

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

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

tbl_all_cog_style_acc_mturk %>%
  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)) + geom_hline(yintercept = .5, linetype = 2)

embedded_chance_mturk <- tbl_all_cog_style_acc_mturk %>% 
  filter(task =="embedded")
embedded_chance_mturk <-t.test(embedded_chance_mturk$rate, mu = .50, alternative="greater")
embedded_chance_mturk
## 
##  One Sample t-test
## 
## data:  embedded_chance_mturk$rate
## t = 10.14, df = 35, p-value = 2.946e-12
## alternative hypothesis: true mean is greater than 0.5
## 95 percent confidence interval:
##  0.7505893       Inf
## sample estimates:
## mean of x 
## 0.8006944
matching_chance_mturk <- tbl_all_cog_style_acc_mturk %>% 
  filter(task =="matching")
matching_chance_mturk <-t.test(matching_chance_mturk$rate, mu = .50, alternative="greater")
matching_chance_mturk
## 
##  One Sample t-test
## 
## data:  matching_chance_mturk$rate
## t = 11.303, df = 35, p-value = 1.565e-13
## alternative hypothesis: true mean is greater than 0.5
## 95 percent confidence interval:
##  0.7244424       Inf
## sample estimates:
## mean of x 
## 0.7638889
tbl_all_cog_style_acc_mturk %>% 
  with(t.test(rate~task,paired=TRUE))
## 
##  Paired t-test
## 
## data:  rate by task
## t = 1.6029, df = 35, p-value = 0.118
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.009810425  0.083421536
## sample estimates:
## mean of the differences 
##              0.03680556

3.2.3 Plot RTs

tbl_all_cog_style_rts_mturk <- tbl_all_cog_style_mturk %>%
  filter(acc == 1)

tbl_all_cog_style_rts_mturk %>%
  ggbarplot("ID", "RT", fill = "task", color = "task", palette = c("#0d2240", "#00a8e1"), font.xtickslab = 8, add = "median", position = position_dodge(0.8), ylab = "Median RT (ms)", ylim = c(0,8000)) + rotate_x_text()

tbl_all_cog_style_rts_mturk %>%
  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,5000))

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

tbl_all_cog_style_rts_median_mturk %>% 
  with(t.test(median_rt~task,paired=TRUE))
## 
##  Paired t-test
## 
## data:  median_rt by task
## t = -6.2276, df = 35, p-value = 3.876e-07
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1882.4374  -956.8682
## sample estimates:
## mean of the differences 
##               -1419.653

3.2.4 Compute cognitive style ratio

The wholist-analytic ratio is calculated by dividing the median response latency to items in the matching figures task (wholist) by the median response latency to items in the embedded figures task (analytic) A ratio of below 1 indicates that an individual responded relatively faster to the matching figure items, corresponding to a wholist profile; a ratio of above 1 indicates that an individual responded relatively faster to the embedded figure items, corresponding to a analytic profile.

tbl_all_cog_style_rts_median_mturk <- tbl_all_cog_style_rts_median_mturk %>% 
  spread(task, median_rt)
tbl_all_cog_style_rts_median_mturk$ratio <- tbl_all_cog_style_rts_median_mturk$matching / tbl_all_cog_style_rts_median_mturk$embedded

tbl_all_cog_style_rts_median_mturk$style = "filler"
for (i in 1:length(tbl_all_cog_style_rts_median_mturk$ID)){
  if (tbl_all_cog_style_rts_median_mturk$ratio[i] > 1){
    tbl_all_cog_style_rts_median_mturk$style[i] = "analytic"
  } else {
    tbl_all_cog_style_rts_median_mturk$style[i] = "wholist"
  }
}

tbl_all_cog_style_rts_median_mturk %>%
  ggbarplot("ID", "ratio", fill = "#f7a800", color = "#f7a800", font.xtickslab = 8, ylim = c(0,15), ylab = "Median wholist-analytic ratio") + rotate_x_text() + geom_hline(yintercept = 1, linetype = 2)

table(tbl_all_cog_style_rts_median_mturk$style)
## 
## analytic  wholist 
##       31        5

3.3 IB performance

tbl_all_IB_mturk <- tbl_all_mturk %>% 
  filter(grepl('Did you notice|item', head))
tbl_all_IB_mturk = subset(tbl_all_IB_mturk, select = -c(stim1,ITI,stimFormat,button1,keyboard,key,responseWindow,randomBlock,responseType,randomPick,responseOptions,pageBreak,required,ITI_ms,ITI_f,ITI_fDuration,responseCode))

3.3.1 Noticers vs. Non-noticers

tbl_all_notice_mturk <- tbl_all_IB_mturk %>% 
  filter(grepl('items', head))
table(tbl_all_notice_mturk$response)
## 
##       No Not sure      Yes 
##       18        9        9

3.3.2 Unexpected event description

tbl_all_event_mturk <- tbl_all_IB_mturk %>% 
  filter(grepl('moved', head))
tbl_all_event_mturk <- cbind.data.frame(tbl_all_event_mturk[1], tbl_all_event_mturk[6])
knitr::kable(tbl_all_event_mturk)
ID response
A3QRZPJT2CT2IK I did not take notice. I was strictly looking for white going across the line.
A1MBEQJXRP50O I did not see any item.
A1P2RQ166VS5BT I didn’t see it. Was concentrated on counting the letters
A2PIFMM4Q2I9ZS I did not see an item
A11TPUPFP2S4MK Not sure
A2CY1TSQ3KKP5Q I did not notice this item
AJ9IY4IHOGB8 t and l move across but + as centre
AXPZAP62ZYWP8 i did not see anything different i was focused on the white shapes
A8028AFBBS29G no
A1WITSTEVRL0S0 +
A3CFF2BT7P8FL4 +
A3180VXVP8MOIH I cannot recall
A37OUZOGQKGMW0 I was not sure if they were in the last task or not.
A208FCEZY5PDKQ E
A2WJMGV0HKQG3Z x
A3FQDPUAXJB0BS I think it was the first one (the +). It moved from right to left on the horizontal line.
AHKYVHP6591H8 Did not remember the item.
AXMPSUNKUBEIL I didn’t notice any other letter or symbol.
A2KCNQ0T27VM2S it moved top to bottom,bottom to up
A36QBKROJ4J9EJ Did not see the objects.
A1W2L6BM7VQCXO I am just T and X
A3R5OJR60C6004 I noticed a “t” but was simply focused on white objects and not any specific detail
AFA888ME14ICF no
A34NDXO56MBC3D The + and it was static
A1J19UOHNI0UOC I honestly don’t recall seeing any of those 3 objects.
A1F1BIPJR11LSR Not sure.
A1PRG2OSEWHYNF the letter L moved here and there
A1V1JNPU0KOA3X I did not notice
A2OVX9UW5WANQE not sure
A11Q8U6QTT8KGF +, it seemed to pulse around the screen
A2QL4LWWYY8ACQ top to bottom
ATH9EZ041GC54 good
A10JXOU89D5RXR did not notice that
A1LA6CIGBNDOH9 I didn’t notice it.
A1TRWC1E9GI836 +
A1F1TBDHPYAAXT T and L

3.4 Post IB questions

3.4.1 Expecting an unexpected event

tbl_all_expecting_mturk <- tbl_all_mturk %>% 
  filter(grepl('Before', head))
tbl_all_expecting_mturk = subset(tbl_all_expecting_mturk, select = -c(stim1,ITI,stimFormat,button1,keyboard,key,responseWindow,randomBlock,responseType,randomPick,responseOptions,pageBreak,required,ITI_ms,ITI_f,ITI_fDuration,responseCode))

table(tbl_all_expecting_mturk$response)
## 
##  No Yes 
##  28   8

3.4.2 Familiarity with IB experiments

tbl_all_familiarity_mturk <- tbl_all_mturk %>% 
  filter(grepl('gorilla', head))
tbl_all_familiarity_mturk = subset(tbl_all_familiarity_mturk, select = -c(stim1,ITI,stimFormat,button1,keyboard,key,responseWindow,randomBlock,responseType,randomPick,responseOptions,pageBreak,required,ITI_ms,ITI_f,ITI_fDuration,responseCode))

table(tbl_all_familiarity_mturk$response)
## 
##  No Yes 
##  28   8

3.5 Cognitive style ratio predicting IB

3.5.1 Logistic regression (Continuous predictor, dichotomous outcome)

3.5.1.1 With outlier

tbl_log_reg_mturk <- merge(tbl_all_cog_style_rts_median_mturk, tbl_all_notice_mturk, by = "ID")
tbl_log_reg_mturk = subset(tbl_log_reg_mturk, select = -c(rowNo,type,head,timestamp,RT,correct))
tbl_log_reg_mturk[tbl_log_reg_mturk == "Yes"] <- 1
tbl_log_reg_mturk[tbl_log_reg_mturk == "No"] <- 0
tbl_log_reg_mturk[tbl_log_reg_mturk == "Not sure"] <- 0
names(tbl_log_reg_mturk)[names(tbl_log_reg_mturk)=="response"] <- "notice"
tbl_log_reg_mturk$notice <- as.numeric(tbl_log_reg_mturk$notice)

log_reg_mturk <- glm(notice ~ ratio, data = tbl_log_reg_mturk, family = binomial(link = "logit"))
summary(log_reg_mturk)
## 
## Call:
## glm(formula = notice ~ ratio, family = binomial(link = "logit"), 
##     data = tbl_log_reg_mturk)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.8187  -0.7568  -0.7390  -0.2504   1.7439  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)  
## (Intercept)  -1.3178     0.5316  -2.479   0.0132 *
## ratio         0.1022     0.1655   0.617   0.5371  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 40.488  on 35  degrees of freedom
## Residual deviance: 40.120  on 34  degrees of freedom
## AIC: 44.12
## 
## Number of Fisher Scoring iterations: 4

3.5.1.2 Without outlier

tbl_log_reg_mturk_no_outlier <- tbl_log_reg_mturk %>% 
  filter(ID != "A208FCEZY5PDKQ")
log_reg_mturk_no_outlier <- glm(notice ~ ratio, data = tbl_log_reg_mturk_no_outlier, family = binomial(link = "logit"))
summary(log_reg_mturk_no_outlier)
## 
## Call:
## glm(formula = notice ~ ratio, family = binomial(link = "logit"), 
##     data = tbl_log_reg_mturk_no_outlier)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -1.32178  -0.56101  -0.23955  -0.01066   2.60991  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)  
## (Intercept)    3.661      1.858   1.971   0.0488 *
## ratio         -3.480      1.430  -2.433   0.0150 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 37.628  on 34  degrees of freedom
## Residual deviance: 25.319  on 33  degrees of freedom
## AIC: 29.319
## 
## Number of Fisher Scoring iterations: 6

3.5.2 Plot

3.5.2.1 With outlier

plot_mturk <- ggplot(tbl_log_reg_mturk, aes(x=ratio, y=notice)) + xlim(0,15) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_mturk))

3.5.2.2 Without outlier

plot_mturk_no_outlier <- ggplot(log_reg_mturk_no_outlier, aes(x=ratio, y=notice)) + xlim(0,5) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_mturk_no_outlier))

3.5.3 Logistic regression (Dichotomous predictor, dichotomous outcome)

3.5.3.1 With outlier

log_reg_mturk <- glm(notice ~ style, data = tbl_log_reg_mturk, family = binomial)
summary(log_reg_mturk)
## 
## Call:
## glm(formula = notice ~ style, family = binomial, data = tbl_log_reg_mturk)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.7941  -0.5931  -0.5931  -0.2778   1.9103  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept)   -1.6487     0.4883  -3.376 0.000735 ***
## stylewholist   3.0350     1.2200   2.488 0.012860 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 40.488  on 35  degrees of freedom
## Residual deviance: 32.396  on 34  degrees of freedom
## AIC: 36.396
## 
## Number of Fisher Scoring iterations: 4

3.5.3.2 Without outlier

log_reg_mturk_no_outlier <- glm(notice ~ style, data = tbl_log_reg_mturk_no_outlier, family = binomial)
summary(log_reg_mturk_no_outlier)
## 
## Call:
## glm(formula = notice ~ style, family = binomial, data = tbl_log_reg_mturk_no_outlier)
## 
## Deviance Residuals: 
##    Min      1Q  Median      3Q     Max  
## -1.794  -0.535  -0.535  -0.535   2.007  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept)   -1.8718     0.5371  -3.485 0.000492 ***
## stylewholist   3.2581     1.2403   2.627 0.008620 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 37.628  on 34  degrees of freedom
## Residual deviance: 28.564  on 33  degrees of freedom
## AIC: 32.564
## 
## Number of Fisher Scoring iterations: 4

4 All Subjects

4.1 Read-in datafiles

Read in the individual subject files (saved automatically on the server as csv files).

Get a count of the number of subjects.

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

4.2 Cognitive Styles

Split up the cognitive styles stimuli nomenclature to task, answer, and number. Filter the two cognitive styles tasks.

tbl_all_cog_style_sona_and_mturk <- tbl_all_sona_and_mturk %>%
  separate(stim1,into=c('task', 'answer', 'number')) %>% 
  filter(task == 'matching' | task == 'embedded')
tbl_all_cog_style_sona_and_mturk = subset(tbl_all_cog_style_sona_and_mturk, select = -c(ITI,stimFormat,button1,keyboard,key,responseWindow,head,responseType,randomPick,responseOptions,pageBreak,required,responseCode,correct))

4.2.1 Analyze accuracy

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).

In the embedded figures task, subjects were instructed to press ‘F’ if the simple shape is within the complex shape and ‘J’ if the the simple shape is not within the complex shape. Trials will be labeled 1 for correct responses (‘F’ for simple within complex and ‘J’ for simple not within complex) and 0 for incorrect responses (‘F’ simple not within complex and ‘J’ simple within complex).

tbl_all_cog_style_sona_and_mturk$acc = "filler"

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

4.2.2 Plot accuracy

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

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

tbl_all_cog_style_acc_sona_and_mturk %>%
  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)) + geom_hline(yintercept = .5, linetype = 2)

embedded_chance_sona_and_mturk <- tbl_all_cog_style_acc_sona_and_mturk %>% 
  filter(task =="embedded")
embedded_chance_sona_and_mturk <-t.test(embedded_chance_sona_and_mturk$rate, mu = .50, alternative="greater")
embedded_chance_sona_and_mturk
## 
##  One Sample t-test
## 
## data:  embedded_chance_sona_and_mturk$rate
## t = 14.978, df = 53, p-value < 2.2e-16
## alternative hypothesis: true mean is greater than 0.5
## 95 percent confidence interval:
##  0.7886742       Inf
## sample estimates:
## mean of x 
##     0.825
matching_chance_sona_and_mturk <- tbl_all_cog_style_acc_sona_and_mturk %>% 
  filter(task =="matching")
matching_chance_sona_and_mturk <-t.test(matching_chance_sona_and_mturk$rate, mu = .50, alternative="greater")
matching_chance_sona_and_mturk
## 
##  One Sample t-test
## 
## data:  matching_chance_sona_and_mturk$rate
## t = 16.137, df = 53, p-value < 2.2e-16
## alternative hypothesis: true mean is greater than 0.5
## 95 percent confidence interval:
##  0.7597481       Inf
## sample estimates:
## mean of x 
## 0.7898148
tbl_all_cog_style_acc_sona_and_mturk %>% 
  with(t.test(rate~task,paired=TRUE))
## 
##  Paired t-test
## 
## data:  rate by task
## t = 2.0058, df = 53, p-value = 0.04999
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  1.418495e-06 7.036895e-02
## sample estimates:
## mean of the differences 
##              0.03518519

4.2.3 Plot RTs

tbl_all_cog_style_rts_sona_and_mturk <- tbl_all_cog_style_sona_and_mturk %>%
  filter(acc == 1)

tbl_all_cog_style_rts_sona_and_mturk %>%
  ggbarplot("ID", "RT", fill = "task", color = "task", palette = c("#0d2240", "#00a8e1"), font.xtickslab = 8, add = "median", position = position_dodge(0.8), ylab = "Median RT (ms)", ylim = c(0,8000)) + rotate_x_text()

tbl_all_cog_style_rts_sona_and_mturk %>%
  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,5000))

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

tbl_all_cog_style_rts_median_sona_and_mturk %>% 
  with(t.test(median_rt~task,paired=TRUE))
## 
##  Paired t-test
## 
## data:  median_rt by task
## t = -7.1719, df = 53, p-value = 2.385e-09
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -2000.797 -1126.258
## sample estimates:
## mean of the differences 
##               -1563.528

4.2.4 Compute cognitive style ratio

The wholist-analytic ratio is calculated by dividing the median response latency to items in the matching figures task (wholist) by the median response latency to items in the embedded figures task (analytic) A ratio of below 1 indicates that an individual responded relatively faster to the matching figure items, corresponding to a wholist profile; a ratio of above 1 indicates that an individual responded relatively faster to the embedded figure items, corresponding to a analytic profile.

tbl_all_cog_style_rts_median_sona_and_mturk <- tbl_all_cog_style_rts_median_sona_and_mturk %>% 
  spread(task, median_rt)
tbl_all_cog_style_rts_median_sona_and_mturk$ratio <- tbl_all_cog_style_rts_median_sona_and_mturk$matching / tbl_all_cog_style_rts_median_sona_and_mturk$embedded

tbl_all_cog_style_rts_median_sona_and_mturk$style = "filler"
for (i in 1:length(tbl_all_cog_style_rts_median_sona_and_mturk$ID)){
  if (tbl_all_cog_style_rts_median_sona_and_mturk$ratio[i] > 1){
    tbl_all_cog_style_rts_median_sona_and_mturk$style[i] = "analytic"
  } else {
    tbl_all_cog_style_rts_median_sona_and_mturk$style[i] = "wholist"
  }
}

tbl_all_cog_style_rts_median_sona_and_mturk %>%
  ggbarplot("ID", "ratio", fill = "#f7a800", color = "#f7a800", font.xtickslab = 8, ylim = c(0,15), ylab = "Median wholist-analytic ratio") + rotate_x_text() + geom_hline(yintercept = 1, linetype = 2)

table(tbl_all_cog_style_rts_median_sona_and_mturk$style)
## 
## analytic  wholist 
##       46        8

4.3 IB performance

tbl_all_IB_sona_and_mturk <- tbl_all_sona_and_mturk %>% 
  filter(grepl('Did you notice|item', head))
tbl_all_IB_sona_and_mturk = subset(tbl_all_IB_sona_and_mturk, select = -c(stim1,ITI,stimFormat,button1,keyboard,key,responseWindow,randomBlock,responseType,randomPick,responseOptions,pageBreak,required,ITI_ms,ITI_f,ITI_fDuration,responseCode))

4.3.1 Noticers vs. Non-noticers

tbl_all_notice_sona_and_mturk <- tbl_all_IB_sona_and_mturk %>% 
  filter(grepl('items', head))
table(tbl_all_notice_sona_and_mturk$response)
## 
##       No Not sure      Yes 
##       22       12       20

4.3.2 Unexpected event description

tbl_all_event_sona_and_mturk <- tbl_all_IB_sona_and_mturk %>% 
  filter(grepl('moved', head))
tbl_all_event_sona_and_mturk <- cbind.data.frame(tbl_all_event_sona_and_mturk[1], tbl_all_event_sona_and_mturk[6])
knitr::kable(tbl_all_event_sona_and_mturk)
ID response
205396 it was the plus sign (+) and it moved from the right hand side towards the left hand side of the screen.
205204 I noticed the plus sign moving across the screen. It moved from right to left across the center line.
205060 the plus sign, moved from right to left, down the horizontal line
205420 the + moves horizontally passing the center of the box.
205255 I feel like I saw the + a few times but did not pay attention to its movement
205189 Plus sign horizontally
205057 I might have seen a + sign but I don’t really remember.
204988 I think I saw + but I am not sure how it moved.
205315 Ts and Ls
205408 +
205051 n/a
204949 The cross on the right.
205306 I’m not sure, but the + might have moved with the letters.
205084 I didn’t see anything unusual
205324 I have no idea. Maybe the black letters were erased so we only had to focus on the white letters.
205225 the middle, plus sign
205429 The cross moved horizontally along the line that the letters were crossing.
205432 X
A3QRZPJT2CT2IK I did not take notice. I was strictly looking for white going across the line.
A1MBEQJXRP50O I did not see any item.
A1P2RQ166VS5BT I didn’t see it. Was concentrated on counting the letters
A2PIFMM4Q2I9ZS I did not see an item
A11TPUPFP2S4MK Not sure
A2CY1TSQ3KKP5Q I did not notice this item
AJ9IY4IHOGB8 t and l move across but + as centre
AXPZAP62ZYWP8 i did not see anything different i was focused on the white shapes
A8028AFBBS29G no
A1WITSTEVRL0S0 +
A3CFF2BT7P8FL4 +
A3180VXVP8MOIH I cannot recall
A37OUZOGQKGMW0 I was not sure if they were in the last task or not.
A208FCEZY5PDKQ E
A2WJMGV0HKQG3Z x
A3FQDPUAXJB0BS I think it was the first one (the +). It moved from right to left on the horizontal line.
AHKYVHP6591H8 Did not remember the item.
AXMPSUNKUBEIL I didn’t notice any other letter or symbol.
A2KCNQ0T27VM2S it moved top to bottom,bottom to up
A36QBKROJ4J9EJ Did not see the objects.
A1W2L6BM7VQCXO I am just T and X
A3R5OJR60C6004 I noticed a “t” but was simply focused on white objects and not any specific detail
AFA888ME14ICF no
A34NDXO56MBC3D The + and it was static
A1J19UOHNI0UOC I honestly don’t recall seeing any of those 3 objects.
A1F1BIPJR11LSR Not sure.
A1PRG2OSEWHYNF the letter L moved here and there
A1V1JNPU0KOA3X I did not notice
A2OVX9UW5WANQE not sure
A11Q8U6QTT8KGF +, it seemed to pulse around the screen
A2QL4LWWYY8ACQ top to bottom
ATH9EZ041GC54 good
A10JXOU89D5RXR did not notice that
A1LA6CIGBNDOH9 I didn’t notice it.
A1TRWC1E9GI836 +
A1F1TBDHPYAAXT T and L

4.4 Post IB questions

4.4.1 Expecting an unexpected event

tbl_all_expecting_sona_and_mturk <- tbl_all_sona_and_mturk %>% 
  filter(grepl('Before', head))
tbl_all_expecting_sona_and_mturk = subset(tbl_all_expecting_sona_and_mturk, select = -c(stim1,ITI,stimFormat,button1,keyboard,key,responseWindow,randomBlock,responseType,randomPick,responseOptions,pageBreak,required,ITI_ms,ITI_f,ITI_fDuration,responseCode))

table(tbl_all_expecting_sona_and_mturk$response)
## 
##  No Yes 
##  42  12

4.4.2 Familiarity with IB experiments

tbl_all_familiarity_sona_and_mturk <- tbl_all_sona_and_mturk %>% 
  filter(grepl('gorilla', head))
tbl_all_familiarity_sona_and_mturk = subset(tbl_all_familiarity_sona_and_mturk, select = -c(stim1,ITI,stimFormat,button1,keyboard,key,responseWindow,randomBlock,responseType,randomPick,responseOptions,pageBreak,required,ITI_ms,ITI_f,ITI_fDuration,responseCode))

table(tbl_all_familiarity_sona_and_mturk$response)
## 
##  No Yes 
##  32  22

4.5 Cognitive style ratio predicting IB

4.5.1 Logistic regression (Continuous predictor, dichotomous outcome)

4.5.1.1 With outlier

tbl_log_reg_sona_and_mturk <- merge(tbl_all_cog_style_rts_median_sona_and_mturk, tbl_all_notice_sona_and_mturk, by = "ID")
tbl_log_reg_sona_and_mturk = subset(tbl_log_reg_sona_and_mturk, select = -c(rowNo,type,head,timestamp,RT,correct))
tbl_log_reg_sona_and_mturk[tbl_log_reg_sona_and_mturk == "Yes"] <- 1
tbl_log_reg_sona_and_mturk[tbl_log_reg_sona_and_mturk == "No"] <- 0
tbl_log_reg_sona_and_mturk[tbl_log_reg_sona_and_mturk == "Not sure"] <- 0
names(tbl_log_reg_sona_and_mturk)[names(tbl_log_reg_sona_and_mturk)=="response"] <- "notice"
tbl_log_reg_sona_and_mturk$notice <- as.numeric(tbl_log_reg_sona_and_mturk$notice)

log_reg_sona_and_mturk <- glm(notice ~ ratio, data = tbl_log_reg_sona_and_mturk, family = binomial(link = "logit"))
summary(log_reg_sona_and_mturk)
## 
## Call:
## glm(formula = notice ~ ratio, family = binomial(link = "logit"), 
##     data = tbl_log_reg_sona_and_mturk)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.1107  -0.9381  -0.9161   1.3749   1.5258  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)  
## (Intercept)  -0.8572     0.4547  -1.885   0.0594 .
## ratio         0.1570     0.1733   0.906   0.3649  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 71.188  on 53  degrees of freedom
## Residual deviance: 70.227  on 52  degrees of freedom
## AIC: 74.227
## 
## Number of Fisher Scoring iterations: 4

4.5.1.2 Without outlier

tbl_log_reg_sona_and_mturk_no_outlier <- tbl_log_reg_sona_and_mturk %>% 
  filter(ID != "A208FCEZY5PDKQ")
log_reg_sona_and_mturk_no_outlier <- glm(notice ~ ratio, data = tbl_log_reg_sona_and_mturk_no_outlier, family = binomial(link = "logit"))
summary(log_reg_sona_and_mturk_no_outlier)
## 
## Call:
## glm(formula = notice ~ ratio, family = binomial(link = "logit"), 
##     data = tbl_log_reg_sona_and_mturk_no_outlier)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.9848  -0.9517  -0.9262   1.3997   1.5136  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.41611    0.64384  -0.646    0.518
## ratio       -0.09005    0.31506  -0.286    0.775
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 69.170  on 52  degrees of freedom
## Residual deviance: 69.087  on 51  degrees of freedom
## AIC: 73.087
## 
## Number of Fisher Scoring iterations: 4

4.5.2 Plot

4.5.2.1 With outlier

plot_sona_and_mturk <- ggplot(tbl_log_reg_sona_and_mturk, aes(x=ratio, y=notice)) + xlim(0,15) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_sona_and_mturk))

4.5.2.2 Without outlier

plot_sona_and_mturk_no_outlier <- ggplot(tbl_log_reg_sona_and_mturk_no_outlier, aes(x=ratio, y=notice)) + xlim(0,5) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_sona_and_mturk_no_outlier))

4.5.3 Logistic regression (Dichotomous predictor, dichotomous outcome)

4.5.3.1 With outlier

log_reg_sona_and_mturk <- glm(notice ~ style, data = tbl_log_reg_sona_and_mturk, family = binomial)
summary(log_reg_sona_and_mturk)
## 
## Call:
## glm(formula = notice ~ style, family = binomial, data = tbl_log_reg_sona_and_mturk)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.4006  -0.8884  -0.8884   1.4971   1.4971  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)  
## (Intercept)   -0.7259     0.3145  -2.308    0.021 *
## stylewholist   1.2368     0.7951   1.555    0.120  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 71.188  on 53  degrees of freedom
## Residual deviance: 68.671  on 52  degrees of freedom
## AIC: 72.671
## 
## Number of Fisher Scoring iterations: 4

4.5.3.2 Without outlier

log_reg_sona_and_mturk_no_outlier <- glm(notice ~ style, data = tbl_log_reg_sona_and_mturk_no_outlier, family = binomial)
summary(log_reg_sona_and_mturk_no_outlier)
## 
## Call:
## glm(formula = notice ~ style, family = binomial, data = tbl_log_reg_sona_and_mturk_no_outlier)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.4006  -0.8633  -0.8633   1.5281   1.5281  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)  
## (Intercept)   -0.7949     0.3220  -2.469   0.0136 *
## stylewholist   1.3058     0.7981   1.636   0.1018  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 69.170  on 52  degrees of freedom
## Residual deviance: 66.384  on 51  degrees of freedom
## AIC: 70.384
## 
## Number of Fisher Scoring iterations: 4