library(tidyverse)
library(ggplot2)
library(ggpubr)
library(plyr)
Set the R working drectory to the main experiment directory.
setwd("/Users/adambarnas/Box/CogStyles_IB")
Read in the individual subject files.
Get a count of the number of subjects.
nrow(tbl_all %>% distinct(ID,.keep_all = FALSE))
## [1] 65
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_cog_style <- tbl_all_blank_removed %>%
filter(grepl('embedded|matching', stim1))
tbl_all_cog_style[tbl_all_cog_style== "embedded_prompt" ] <- NA
tbl_all_cog_style[tbl_all_cog_style== "matching_prompt" ] <- NA
tbl_all_cog_style[tbl_all_cog_style== "timeout" ] <- NA
tbl_all_cog_style <- tbl_all_cog_style %>%
group_by(ID) %>%
fill(stim1) %>% #default direction down
fill(stim1, .direction = "up")
tbl_all_cog_style_condensed <- tbl_all_cog_style %>%
group_by(ID, stim1) %>%
dplyr::summarise(RT = sum(rt), response = first(na.omit(response)))
Split up the cognitive styles stimuli nomenclature to task, answer, and number. Filter the two cognitive styles tasks.
tbl_all_cog_style_condensed <- tbl_all_cog_style_condensed %>%
separate(stim1,into=c('task', 'answer', 'number'))
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_condensed$acc = "filler"
for (i in 1:length(tbl_all_cog_style_condensed$ID)){
if (tbl_all_cog_style_condensed$task[i] == "matching"){
if (tbl_all_cog_style_condensed$answer[i] == "same"){
if (tbl_all_cog_style_condensed$response[i] == "f"){
tbl_all_cog_style_condensed$acc[i] = 1
} else {
tbl_all_cog_style_condensed$acc[i] = 0
}
} else {
if (tbl_all_cog_style_condensed$response[i] == "j"){
tbl_all_cog_style_condensed$acc[i] = 1
} else {
tbl_all_cog_style_condensed$acc[i] = 0
}
}
}
if (tbl_all_cog_style_condensed$task[i] == "embedded"){
if (tbl_all_cog_style_condensed$answer[i] == "yes"){
if (tbl_all_cog_style_condensed$response[i] == "f"){
tbl_all_cog_style_condensed$acc[i] = 1
} else {
tbl_all_cog_style_condensed$acc[i] = 0
}
} else {
if (tbl_all_cog_style_condensed$response[i] == "j"){
tbl_all_cog_style_condensed$acc[i] = 1
} else {
tbl_all_cog_style_condensed$acc[i] = 0
}
}
}
}
write.csv(tbl_all_cog_style_condensed,'embedded_matching_data.csv', row.names=FALSE)
tbl_all_cog_style_condensed_acc <- tbl_all_cog_style_condensed %>%
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_condensed_acc) <- c("ID", "task", "inacc", "acc", "total")
tbl_all_cog_style_condensed_acc[is.na(tbl_all_cog_style_condensed_acc)] <- 0
tbl_all_cog_style_condensed_acc$rate <- tbl_all_cog_style_condensed_acc$acc / tbl_all_cog_style_condensed_acc$total
tbl_all_cog_style_condensed_acc %>%
ggbarplot("ID", "rate", fill = "task", color = "task", palette = c("#0d2240", "#00a8e1"), font.xtickslab = 6, ylab = "Accuracy", ylim = c(0, 1), position = position_dodge(0.8)) + rotate_x_text() + geom_hline(yintercept = .5, linetype = 2)
tbl_all_cog_style_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)) + geom_hline(yintercept = .5, linetype = 2)
embedded_chance_sona <- tbl_all_cog_style_condensed_acc %>%
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 = 16.99, df = 64, p-value < 2.2e-16
## alternative hypothesis: true mean is greater than 0.5
## 95 percent confidence interval:
## 0.7871772 Inf
## sample estimates:
## mean of x
## 0.8184615
matching_chance_sona <- tbl_all_cog_style_condensed_acc %>%
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 = 15.229, df = 64, p-value < 2.2e-16
## alternative hypothesis: true mean is greater than 0.5
## 95 percent confidence interval:
## 0.7256833 Inf
## sample estimates:
## mean of x
## 0.7534615
tbl_all_cog_style_condensed_acc %>%
with(t.test(rate~task,paired=TRUE))
##
## Paired t-test
##
## data: rate by task
## t = 4.8539, df = 64, p-value = 8.124e-06
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.0382478 0.0917522
## sample estimates:
## mean of the differences
## 0.065
tbl_all_cog_style_condensed_acc <- subset(tbl_all_cog_style_condensed_acc, select = c(ID, task, rate))
tbl_all_cog_style_condensed_acc_wide <- tbl_all_cog_style_condensed_acc %>%
spread(task,rate)
tbl_all_cog_style_condensed_acc <- tbl_all_cog_style_condensed_acc_wide %>%
filter(embedded > 0.5 & matching > 0.5)
tbl_all_cog_style_condensed_acc <- gather(tbl_all_cog_style_condensed_acc, task, rate, embedded:matching, factor_key=TRUE)
tbl_all_cog_style_condensed_acc %>%
ggbarplot("ID", "rate", fill = "task", color = "task", palette = c("#0d2240", "#00a8e1"), font.xtickslab = 6, ylab = "Accuracy", ylim = c(0, 1), position = position_dodge(0.8)) + rotate_x_text() + geom_hline(yintercept = .5, linetype = 2)
tbl_all_cog_style_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)) + geom_hline(yintercept = .5, linetype = 2)
embedded_chance_sona <- tbl_all_cog_style_condensed_acc %>%
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 = 29.051, df = 56, p-value < 2.2e-16
## alternative hypothesis: true mean is greater than 0.5
## 95 percent confidence interval:
## 0.8414234 Inf
## sample estimates:
## mean of x
## 0.8622807
matching_chance_sona <- tbl_all_cog_style_condensed_acc %>%
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 = 21.68, df = 56, p-value < 2.2e-16
## alternative hypothesis: true mean is greater than 0.5
## 95 percent confidence interval:
## 0.7659282 Inf
## sample estimates:
## mean of x
## 0.7881579
tbl_all_cog_style_condensed_acc %>%
with(t.test(rate~task,paired=TRUE))
##
## Paired t-test
##
## data: rate by task
## t = 5.4236, df = 56, p-value = 1.289e-06
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04674492 0.10150069
## sample estimates:
## mean of the differences
## 0.07412281
tbl_all_cog_style_condensed_rts <- tbl_all_cog_style_condensed[(tbl_all_cog_style_condensed$ID %in% tbl_all_cog_style_condensed_acc$ID),] %>%
filter(acc == 1)
tbl_all_cog_style_condensed_rts %>%
ggbarplot("ID", "RT", fill = "task", color = "task", palette = c("#0d2240", "#00a8e1"), font.xtickslab = 6, add = "median", position = position_dodge(0.8), ylab = "Median RT (ms)", ylim = c(0,6000)) + rotate_x_text()
tbl_all_cog_style_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,5000))
tbl_all_cog_style_condensed_rts_median <- tbl_all_cog_style_condensed_rts %>%
group_by(ID,task) %>%
dplyr::summarize(median_rt = median(RT, na.rm=TRUE))
tbl_all_cog_style_condensed_rts_median %>%
with(t.test(median_rt~task,paired=TRUE))
##
## Paired t-test
##
## data: median_rt by task
## t = -15.089, df = 56, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1438.777 -1101.521
## sample estimates:
## mean of the differences
## -1270.149
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_condensed_rts_median <- tbl_all_cog_style_condensed_rts_median %>%
spread(task, median_rt)
tbl_all_cog_style_condensed_rts_median$ratio <- tbl_all_cog_style_condensed_rts_median$matching / tbl_all_cog_style_condensed_rts_median$embedded
tbl_all_cog_style_condensed_rts_median$style = "filler"
for (i in 1:length(tbl_all_cog_style_condensed_rts_median$ID)){
if (tbl_all_cog_style_condensed_rts_median$ratio[i] > 1){
tbl_all_cog_style_condensed_rts_median$style[i] = "analytic"
} else {
tbl_all_cog_style_condensed_rts_median$style[i] = "wholist"
}
}
tbl_all_cog_style_condensed_rts_median %>%
ggbarplot("ID", "ratio", fill = "#f7a800", color = "#f7a800", ylim = c(0,4), font.xtickslab = 6, ylab = "Median wholist-analytic ratio") + rotate_x_text() + geom_hline(yintercept = 1, linetype = 2)
table(tbl_all_cog_style_condensed_rts_median$style)
##
## analytic
## 57
tbl_all_IB <- tbl_all %>%
filter(grepl('Did you notice|item', head))
tbl_all_IB = subset(tbl_all_IB, 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_IB <- tbl_all_IB[(tbl_all_IB$ID %in% tbl_all_cog_style_condensed_rts_median$ID),]
tbl_all_counting <- tbl_all %>%
filter(rowNo >= 406 & rowNo <= 433)
tbl_all_counting = subset(tbl_all_counting, select = -c(rowNo,type,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))
tbl_all_counting <- tbl_all_counting[(tbl_all_counting$ID %in% tbl_all_cog_style_condensed_rts_median$ID),]
tbl_all_counting <- cbind(tbl_all_counting[c(TRUE, FALSE), ],tbl_all_counting[c(FALSE, TRUE), ])
tbl_all_counting = subset(tbl_all_counting, select = -c(3:5))
tbl_counts <- read_csv("./IB_stims/IB_counting.csv")
tbl_counts_comparison <- full_join(tbl_all_counting, tbl_counts, by = "stim1")
tbl_counts_comparison <- tbl_counts_comparison[complete.cases(tbl_counts_comparison), ]
tbl_counts_comparison$response <- as.numeric(tbl_counts_comparison$response)
tbl_counts_comparison$count <- as.numeric(tbl_counts_comparison$count)
tbl_counts_comparison$error <- (abs(tbl_counts_comparison$response - tbl_counts_comparison$count) / tbl_counts_comparison$count) * 100
tbl_counts_comparison %>%
ggbarplot("ID", "error", fill = "#f7a800", color = "#f7a800", ylim = c(0,150), font.xtickslab = 6, add = "mean_se", ylab = "Mean Percent Error on Midline-crossings Task") + rotate_x_text() + geom_hline(yintercept = 50, linetype = 2)
tbl_counts_comparison_average <- tbl_counts_comparison %>%
group_by(ID) %>%
dplyr::summarize(mean_error = mean(error, na.rm=TRUE))
tbl_counts_comparison_average %>%
ggbarplot(y = "mean_error", fill = "#f7a800", color = "#f7a800", ylim = c(0,100), sort.val = c("asc") ,xlab = "Group", add = "mean_se", ylab = "Mean Percent Error on Midline-crossings Task")
error <-t.test(tbl_counts_comparison_average$mean_error, mu = 0, alternative="greater")
error
##
## One Sample t-test
##
## data: tbl_counts_comparison_average$mean_error
## t = 5.2325, df = 56, p-value = 1.295e-06
## alternative hypothesis: true mean is greater than 0
## 95 percent confidence interval:
## 11.97183 Inf
## sample estimates:
## mean of x
## 17.59633
write.csv(tbl_counts_comparison,'IB_counting.csv', row.names=FALSE)
tbl_counts_comparison_average_good <- tbl_counts_comparison_average %>%
filter(mean_error < 50)
tbl_counts_comparison_good <- tbl_counts_comparison[(tbl_counts_comparison$ID %in% tbl_counts_comparison_average_good$ID),]
tbl_counts_comparison_good %>%
ggbarplot("ID", "error", fill = "#f7a800", color = "#f7a800", ylim = c(0,50), font.xtickslab = 6, add = "mean_se", ylab = "Mean Percent Error on Midline-crossings Task") + rotate_x_text()
tbl_counts_comparison_average_good %>%
ggbarplot(y = "mean_error", fill = "#f7a800", color = "#f7a800", ylim = c(0,100), sort.val = c("asc") ,xlab = "Group", add = "mean_se", ylab = "Mean Percent Error on Midline-crossings Task")
error_good <-t.test(tbl_counts_comparison_average_good$mean_error, mu = 0, alternative="greater")
error_good
##
## One Sample t-test
##
## data: tbl_counts_comparison_average_good$mean_error
## t = 6.2154, df = 47, p-value = 6.347e-08
## alternative hypothesis: true mean is greater than 0
## 95 percent confidence interval:
## 5.626806 Inf
## sample estimates:
## mean of x
## 7.707548
tbl_all_IB <- tbl_all_IB[(tbl_all_IB$ID %in% tbl_counts_comparison_average_good$ID),]
tbl_all_notice <- tbl_all_IB %>%
filter(grepl('items', head))
table(tbl_all_notice$response)
##
## No Not sure Yes
## 21 12 15
tbl_all_notice = subset(tbl_all_notice, select = -c(rowNo,type,head,timestamp,RT))
write.csv(tbl_all_notice,'IB_notice.csv', row.names=FALSE)
tbl_all_event <- tbl_all_IB %>%
filter(grepl('moved', head))
tbl_all_event <- cbind.data.frame(tbl_all_event[1], tbl_all_event[6])
knitr::kable(tbl_all_event)
| ID | response |
|---|---|
| A1969Q0R4Y0E3J | I am guessing one of those items were present and moved at a slower rate than others. |
| A270HX8LH9LJ8W | I didn’t consciously see one of those items. |
| A171RZ3O028XF6 | maybe the E or plus sign |
| AYFDUTHXE54I | I saw letters T L crossing a center line where as L is in white color. |
| A3IXWFXJC2YKU7 | The large X perhaps |
| A2OPYRV3GLAPS1 | I didn’t notice anything. |
| AD1WGUMVD6KED | I think there was a plus sign somewhere. |
| A1IQUHRI7G63YF | The plus sign appeared on the line |
| A2XQ3CFB5HT2ZQ | no idea |
| AMPMTF5IAAMK8 | an x moved on a horizontal line |
| A2HRUFTA09371Y | #NAME? |
| A3LT7W355XOAKF | x, only a guess, moved the same as the others |
| A1SHLWKA0UH1IS | I did not notice it. |
| AM8OWAW9TUVLN | I just watched the white ones and forgot what they were |
| A1U4DNYKF6YUY3 | +, moved along the center horizontal line from the right to the left. |
| A3RHJEMZ4EGY2U | It seemed that something was moving faster but I have no idea what it was because I was busy trying to count. |
| A2HJDLSU95MH8Q | no idea, sorry |
| A15XIKX3PI7SLK | I did not notice any of the items. |
| A3N0QZ9ZKUCTCQ | Plus sign, moving slowly right to left. |
| A2FOYHZ7HOFKBI | Didn’t see any of the items, I was too focused on the white letters |
| A1W7I6FN183I8F | I did not see those letters/equation appear at all while I was counting. |
| A1P3HHEXWNLJMP | I did not notice it at all. |
| A1JR35HATOEME9 | They moved slower |
| ACKG8OU1KHKO2 | plus sign moved on the left side on the line. |
| AD21ES5UMD77U | I did not see any of the previous items |
| A2OX8TSRCU6NKD | I did not see anything different but if there was my guess was it didn’t move |
| A1N0Q3QP4OMTZ2 | It moved right on the center line, and it was the third image (grey cross). |
| A2I6ZALE49CVSC | It just moved across the screen |
| A279YSE7NB16M0 | no |
| AONN1W54VC8YD | The + symbol moved to left, along the line. |
| A198MSVO1VTAT5 | I didn’t notice it at all. I was watching the L T. |
| A2K287FPB9YFIE | I didn’t pay attention to the dark symbols. |
| A3APKUC67F9IMW | I’m sure I saw crosses but not in the dimensions or rotation that you have there. You got me worried when you hit me right in the gut immediately. |
| A22VZZFOP9D3GC | x |
| A1QKIA8XRNEXIG | I’m not sure, I didn’t notice any unusual items in the animation |
| A1O0BGHFTMPQM0 | DIDN’T NOTICE IT |
| A3EC3OP6U52JYC | I saw a gray cross move from right to left across the middle of the screen. |
| AKVDK30EEV08C | I didn’t notice anything different. |
| A31JM9RECQGYEX | none of them were present |
| A297OTX4PW0XS3 | The plus symbol moved along the line from one side to the other. |
| A2R75YFKVALBXE | Didn’t see it. |
| AFIK3VBMMX6G6 | plus sign, right to left |
| AQN3WMCEA96DQ | I was only paying attention to the white figures. Maybe an X crossed the screen though. just a guess |
| A1Q4ZOXZ0Y7K6I | I saw a gray plus shape moving from right to left on the line |
| A3OP24TYKA619W | i did not see it. too busy concentrating |
| A2POU9TTW177VH | I did not see it |
| A37BGU8FSIP4I6 | T L |
| A2ZDEERVRN5AMC | I was too focused on the purple line. |
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_cog_style_condensed_rts_median$ID),]
table(tbl_all_expecting$response)
##
## No Yes
## 45 3
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_cog_style_condensed_rts_median$ID),]
table(tbl_all_familiarity$response)
##
## No Yes
## 34 14
tbl_log_reg_median <- merge(tbl_all_cog_style_condensed_rts_median, tbl_all_notice, by = "ID")
#tbl_log_reg_median = subset(tbl_log_reg_median, select = -c(rowNo,type,head,timestamp,RT))
tbl_log_reg_median[tbl_log_reg_median == "Yes"] <- 1
tbl_log_reg_median[tbl_log_reg_median == "No"] <- 0
tbl_log_reg_median[tbl_log_reg_median == "Not sure"] <- 0
names(tbl_log_reg_median)[names(tbl_log_reg_median)=="response"] <- "notice"
tbl_log_reg_median$notice <- as.numeric(tbl_log_reg_median$notice)
log_reg_median_ratio <- glm(notice ~ ratio, data = tbl_log_reg_median, family = binomial(link = "logit"))
summary(log_reg_median_ratio)
##
## Call:
## glm(formula = notice ~ ratio, family = binomial(link = "logit"),
## data = tbl_log_reg_median)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.9599 -0.8779 -0.8372 1.4568 1.7207
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.1429 1.3656 -0.105 0.917
## ratio -0.3461 0.7180 -0.482 0.630
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 59.624 on 47 degrees of freedom
## Residual deviance: 59.386 on 46 degrees of freedom
## AIC: 63.386
##
## Number of Fisher Scoring iterations: 4
plot_median_ratio <- ggplot(tbl_log_reg_median, aes(x=ratio, y=notice)) + xlim(1,4) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_median_ratio))
log_reg_embedded_median <- glm(notice ~ embedded, data = tbl_log_reg_median, family = binomial(link = "logit"))
summary(log_reg_embedded_median)
##
## Call:
## glm(formula = notice ~ embedded, family = binomial(link = "logit"),
## data = tbl_log_reg_median)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.9790 -0.8878 -0.8354 1.4098 1.8595
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.4501601 1.5725125 0.286 0.775
## embedded -0.0007989 0.0010054 -0.795 0.427
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 59.624 on 47 degrees of freedom
## Residual deviance: 58.956 on 46 degrees of freedom
## AIC: 62.956
##
## Number of Fisher Scoring iterations: 4
plot_embedded_median <- ggplot(tbl_log_reg_median, aes(x=embedded, y=notice)) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_embedded_median))
log_reg_matching_median <- glm(notice ~ matching, data = tbl_log_reg_median, family = binomial(link = "logit"))
summary(log_reg_matching_median)
##
## Call:
## glm(formula = notice ~ matching, family = binomial(link = "logit"),
## data = tbl_log_reg_median)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.0319 -0.8921 -0.7818 1.3609 1.9156
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.5517346 1.3364426 0.413 0.680
## matching -0.0004711 0.0004647 -1.014 0.311
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 59.624 on 47 degrees of freedom
## Residual deviance: 58.519 on 46 degrees of freedom
## AIC: 62.519
##
## Number of Fisher Scoring iterations: 4
plot_matching_median <- ggplot(tbl_log_reg_median, aes(x=matching, y=notice)) + 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))
Does not work because there are no ‘wholists’
#log_reg_style <- glm(notice ~ style, data = tbl_log_reg, family = binomial)
#summary(log_reg_style)
tbl_all_cog_style_condensed_acc_wide <- tbl_all_cog_style_condensed_acc_wide[(tbl_all_cog_style_condensed_acc_wide$ID %in% tbl_log_reg_median$ID),]
tbl_log_reg_acc <- merge(tbl_all_cog_style_condensed_acc_wide, tbl_all_notice, by = "ID")
#tbl_log_reg_acc = subset(tbl_log_reg_acc, select = -c(rowNo,type,head,timestamp,RT))
tbl_log_reg_acc[tbl_log_reg_acc == "Yes"] <- 1
tbl_log_reg_acc[tbl_log_reg_acc == "No"] <- 0
tbl_log_reg_acc[tbl_log_reg_acc == "Not sure"] <- 0
names(tbl_log_reg_acc)[names(tbl_log_reg_acc)=="response"] <- "notice"
tbl_log_reg_acc$notice <- as.numeric(tbl_log_reg_acc$notice)
tbl_log_reg_acc$ratio <- tbl_log_reg_acc$matching / tbl_log_reg_acc$embedded
log_reg_acc_ratio <- glm(notice ~ ratio, data = tbl_log_reg_acc, family = binomial(link = "logit"))
summary(log_reg_acc_ratio)
##
## Call:
## glm(formula = notice ~ ratio, family = binomial(link = "logit"),
## data = tbl_log_reg_acc)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.9427 -0.8701 -0.8542 1.4859 1.5967
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.1381 2.5579 -0.054 0.957
## ratio -0.7011 2.7418 -0.256 0.798
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 59.624 on 47 degrees of freedom
## Residual deviance: 59.559 on 46 degrees of freedom
## AIC: 63.559
##
## Number of Fisher Scoring iterations: 4
plot_acc_ratio <- ggplot(tbl_log_reg_acc, aes(x=ratio, y=notice)) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_acc_ratio))
log_reg_embedded_acc <- glm(notice ~ embedded, data = tbl_log_reg_acc, family = binomial(link = "logit"))
summary(log_reg_embedded_acc)
##
## Call:
## glm(formula = notice ~ embedded, family = binomial(link = "logit"),
## data = tbl_log_reg_acc)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.9341 -0.8696 -0.8385 1.5007 1.5694
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.0378 2.7458 -0.014 0.989
## embedded -0.8703 3.1683 -0.275 0.784
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 59.624 on 47 degrees of freedom
## Residual deviance: 59.549 on 46 degrees of freedom
## AIC: 63.549
##
## Number of Fisher Scoring iterations: 4
plot_embedded_acc <- ggplot(tbl_log_reg_acc, aes(x=embedded, y=notice)) + geom_point() + stat_smooth(method="glm", method.args=list(family="binomial"), se=TRUE, color="#f7a800") + theme_classic((base_size = 15))
suppressMessages(print(plot_embedded_acc))
log_reg_matching_acc <- glm(notice ~ matching, data = tbl_log_reg_acc, family = binomial(link = "logit"))
summary(log_reg_matching_acc)
##
## Call:
## glm(formula = notice ~ matching, family = binomial(link = "logit"),
## data = tbl_log_reg_acc)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.0515 -0.8823 -0.7937 1.4271 1.6460
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.202 2.596 0.463 0.643
## matching -2.509 3.265 -0.768 0.442
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 59.624 on 47 degrees of freedom
## Residual deviance: 59.032 on 46 degrees of freedom
## AIC: 63.032
##
## Number of Fisher Scoring iterations: 4
plot_matching_acc <- ggplot(tbl_log_reg_acc, aes(x=matching, y=notice)) + 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))
Does not work because there are no ‘wholists’
#log_reg_style <- glm(notice ~ style, data = tbl_log_reg, family = binomial)
#summary(log_reg_style)
tbl_log_reg_median_acc <- cbind.data.frame(tbl_log_reg_median, tbl_log_reg_acc[c(2,3,5)])
colnames(tbl_log_reg_median_acc) <- c("ID", "embedded_rt", "matching_rt", "ratio_rt", "style", "notice", "embedded_acc", "matching_acc", "ratio_acc")
log_reg_median_acc_ratio <- glm(notice ~ ratio_rt * ratio_acc, data=tbl_log_reg_median_acc, family=binomial)
summary(log_reg_median_acc_ratio)
##
## Call:
## glm(formula = notice ~ ratio_rt * ratio_acc, family = binomial,
## data = tbl_log_reg_median_acc)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.0520 -0.8735 -0.8326 1.4500 1.6478
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.875 11.269 0.344 0.731
## ratio_rt -2.505 6.320 -0.396 0.692
## ratio_acc -4.373 12.153 -0.360 0.719
## ratio_rt:ratio_acc 2.325 6.668 0.349 0.727
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 59.624 on 47 degrees of freedom
## Residual deviance: 59.256 on 44 degrees of freedom
## AIC: 67.256
##
## Number of Fisher Scoring iterations: 4
log_reg_embedded_median_acc <- glm(notice ~ embedded_rt * embedded_acc, data = tbl_log_reg_median_acc, family = binomial(link = "logit"))
summary(log_reg_embedded_median_acc)
##
## Call:
## glm(formula = notice ~ embedded_rt * embedded_acc, family = binomial(link = "logit"),
## data = tbl_log_reg_median_acc)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.1126 -0.8714 -0.8318 1.4316 1.8466
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 6.895291 11.758547 0.586 0.558
## embedded_rt -0.004481 0.007605 -0.589 0.556
## embedded_acc -7.746923 14.024608 -0.552 0.581
## embedded_rt:embedded_acc 0.004451 0.009084 0.490 0.624
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 59.624 on 47 degrees of freedom
## Residual deviance: 58.602 on 44 degrees of freedom
## AIC: 66.602
##
## Number of Fisher Scoring iterations: 4
log_reg_matching_median_acc <- glm(notice ~ matching_rt * matching_acc, data = tbl_log_reg_median_acc, family = binomial(link = "logit"))
summary(log_reg_matching_median_acc)
##
## Call:
## glm(formula = notice ~ matching_rt * matching_acc, family = binomial(link = "logit"),
## data = tbl_log_reg_median_acc)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.3314 -0.8375 -0.7829 1.3555 1.8441
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 10.976456 12.821806 0.856 0.392
## matching_rt -0.003868 0.004627 -0.836 0.403
## matching_acc -13.397924 16.142370 -0.830 0.407
## matching_rt:matching_acc 0.004322 0.005696 0.759 0.448
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 59.624 on 47 degrees of freedom
## Residual deviance: 57.782 on 44 degrees of freedom
## AIC: 65.782
##
## Number of Fisher Scoring iterations: 4