Recruited a few more participants by mistake.
df.response <- read.csv("../../data/adults/PROCESSED_DATA/response.csv")
#unique(data$PID)
df.response %>%
filter(trial == 1) %>%
group_by(condition) %>%
count() %>%
knitr::kable()
condition | n |
---|---|
B-2O | 32 |
B-3O | 32 |
IGNORANCE | 33 |
#2 more for ignorance, 1 more each for B-2O and B-3O
ggplot(df.response %>%
filter(block %in% c("1", "2")) %>%
group_by(PID, condition) %>%
summarise(mean_correct_resp = mean(correct_resp)),
aes(x = condition, y = mean_correct_resp)) +
geom_violin() +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
geom_jitter(alpha = 0.5,
height = 0) +
geom_hline(yintercept = 1/3, linetype = 'dashed') +
ylim(0, 1) +
labs(title = "Proportion selecting target object")
## `summarise()` has grouped output by 'PID'. You can override using the `.groups`
## argument.
ggplot(df.response %>%
filter(block %in% c("1", "2")) %>%
group_by(PID, condition, block) %>%
summarise(mean_correct_resp = mean(correct_resp)),
aes(x = condition, y = mean_correct_resp)) +
geom_violin() +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
geom_jitter(alpha = 0.5,
height = 0) +
geom_hline(yintercept = 1/3, linetype = 'dashed') +
ylim(0, 1) +
facet_grid(~block) +
labs(title = "Proportion selecting target object by testing block.
Really no significant difference.")
## `summarise()` has grouped output by 'PID', 'condition'. You can override using
## the `.groups` argument.
ggplot(df.response %>%
filter(block %in% c("1", "2")) %>%
group_by(PID, condition, block) %>%
summarise(mean_chose_unknown = mean(chose_unknown)),
aes(x = condition, y = mean_chose_unknown)) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
geom_jitter(alpha = 0.5,
height = 0) +
#facet_grid(~block) +
geom_hline(yintercept = 1/3, linetype = 'dashed') +
ylim(0, 1) +
labs(title = "Proportion selecting the 'unknonw' object.
In the IGNORANCE condition these are the objects that Ella doesn't know.
In the Baseline conditions these are just one of two distractors.")
## `summarise()` has grouped output by 'PID', 'condition'. You can override using
## the `.groups` argument.
ggplot(df.response %>%
filter(block == "mem_check") %>%
group_by(PID) %>%
summarise(sum_memory_check = sum(correct_mem_check)),
aes(x = sum_memory_check)) +
geom_bar() +
labs(title = "Histogram of scores in the memory check. min score = 0, max score = 4")
df.mem_check_perf <- df.response %>%
filter(block == "mem_check") %>%
group_by(PID) %>%
summarise(sum_memory_check = sum(correct_mem_check))
ggplot(df.response %>%
left_join(., df.mem_check_perf) %>%
filter(block %in% c("1", "2"),
condition == "IGNORANCE") %>%
group_by(PID, sum_memory_check) %>%
summarise(mean_chose_unknown = mean(chose_unknown)),
aes(x = as.factor(sum_memory_check), y = mean_chose_unknown)) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
geom_jitter(alpha = 0.5,
height = 0) +
geom_hline(yintercept = 1/3, linetype = 'dashed') +
ylim(0, 1) +
labs(title = "Proportion selecting the 'unknown' object in the IGNORANCE condition,
by score in the memory check section.
Lower performance in memory check --> more likely to choose the object
Ella said she doesn't know the name of (but very small n)")
## Joining with `by = join_by(PID)`
## `summarise()` has grouped output by 'PID'. You can override using the `.groups`
## argument.
Random structure: by-participant and by-target-object random intercepts.
Question: this was our preregistration, not sure if we need a random intercept with label as well.
Model 1: choice of target object (0/1) ~ 1 + (1|participant) + (1|object) + offset(qlogis(⅓))
fit.target <- glmer(correct_resp ~ 1 + (1|PID) + (1|target_object_code) + offset(qlogis(offset)),
data = df.response %>%
filter(block != "mem_check") %>%
mutate(offset = 1/3),
family = binomial(link = 'logit'))
summary(fit.target)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## correct_resp ~ 1 + (1 | PID) + (1 | target_object_code) + offset(qlogis(offset))
## Data: df.response %>% filter(block != "mem_check") %>% mutate(offset = 1/3)
##
## AIC BIC logLik deviance df.resid
## 1273.6 1289.7 -633.8 1267.6 1549
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.2169 -0.4178 0.1972 0.3571 2.7521
##
## Random effects:
## Groups Name Variance Std.Dev.
## PID (Intercept) 4.4974 2.1207
## target_object_code (Intercept) 0.3007 0.5484
## Number of obs: 1552, groups: PID, 97; target_object_code, 12
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.6256 0.2893 9.076 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Model 2: choice of unknown object (0/1) ~ 1 + (1|participant) + (1|object) + offset(qlogis(⅓)) nothing weird here…
fit.unknown <- glmer(chose_unknown ~ 1 + (1|PID) + (1|target_object_code) + offset(qlogis(offset)),
data = df.response %>%
filter(block != "mem_check") %>%
mutate(offset = 1/3),
family = binomial(link = 'logit'))
summary(fit.unknown)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## chose_unknown ~ 1 + (1 | PID) + (1 | target_object_code) + offset(qlogis(offset))
## Data: df.response %>% filter(block != "mem_check") %>% mutate(offset = 1/3)
##
## AIC BIC logLik deviance df.resid
## 944.7 960.7 -469.3 938.7 1549
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.5519 -0.2992 -0.1709 -0.0924 7.9608
##
## Random effects:
## Groups Name Variance Std.Dev.
## PID (Intercept) 3.1469 1.7740
## target_object_code (Intercept) 0.8529 0.9235
## Number of obs: 1552, groups: PID, 97; target_object_code, 12
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.5031 0.3884 -6.444 1.16e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Model 3: add condition Model 3: choice of target object (0/1) ~ presentation (Baseline Two Objects / Baseline Three Objects / Ignorance) + (1|participant) + (1|object)
There is a significant effect of condition.
Update 2/28: after rereading the prereg I realized we preregistered to make the reference level Ignorance (initially was B2O). So if we’re just reading the estimates off of the model, then there is a significance difference between Baseline 3 Objects and Ignorance condition, and no significance difference between B2O and Ignorance. But if we do a pairwise comparison with Tukey’s correction, then there is no difference between Ignorance with either Baseline conditions.
Pairwise comparisons (with Tukey’s):
B2O > B3O (significant)
B2O vs. IGNORANCE – not significant
B3O vs. IGNORANCE – marginally significant (p = .08)
fit.pres_baseline <- glmer(correct_resp ~ 1 + (1|PID) + (1|target_object_code),
data = df.response %>%
mutate(condition = factor(condition,
levels = c("IGNORANCE", "B-3O", "B-2O"))) %>%
filter(block != "mem_check"),
family = binomial(link = 'logit'))
summary(fit.pres_baseline)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: correct_resp ~ 1 + (1 | PID) + (1 | target_object_code)
## Data:
## df.response %>% mutate(condition = factor(condition, levels = c("IGNORANCE",
## "B-3O", "B-2O"))) %>% filter(block != "mem_check")
##
## AIC BIC logLik deviance df.resid
## 1273.6 1289.7 -633.8 1267.6 1549
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.2169 -0.4178 0.1972 0.3571 2.7521
##
## Random effects:
## Groups Name Variance Std.Dev.
## PID (Intercept) 4.4974 2.1207
## target_object_code (Intercept) 0.3007 0.5484
## Number of obs: 1552, groups: PID, 97; target_object_code, 12
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.9324 0.2893 6.68 2.4e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
fit.pres <- glmer(correct_resp ~ condition + (1|PID) + (1|target_object_code),
data = df.response %>%
mutate(condition = factor(condition,
levels = c("IGNORANCE", "B-3O", "B-2O"))) %>%
filter(block != "mem_check"),
family = binomial(link = 'logit'))
summary(fit.pres)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: correct_resp ~ condition + (1 | PID) + (1 | target_object_code)
## Data:
## df.response %>% mutate(condition = factor(condition, levels = c("IGNORANCE",
## "B-3O", "B-2O"))) %>% filter(block != "mem_check")
##
## AIC BIC logLik deviance df.resid
## 1267.1 1293.8 -628.5 1257.1 1547
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.3045 -0.4070 0.1885 0.3553 2.8383
##
## Random effects:
## Groups Name Variance Std.Dev.
## PID (Intercept) 4.237 2.0583
## target_object_code (Intercept) 0.299 0.5468
## Number of obs: 1552, groups: PID, 97; target_object_code, 12
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.1758 0.4455 4.883 1.04e-06 ***
## conditionB-3O -1.2050 0.5654 -2.131 0.0331 *
## conditionB-2O 0.6364 0.6017 1.058 0.2902
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cnB-3O
## conditnB-3O -0.681
## conditnB-2O -0.602 0.478
anova(fit.pres, fit.pres_baseline, type = 3)
## Data: df.response %>% mutate(condition = factor(condition, levels = c("IGNORANCE", ...
## Models:
## fit.pres_baseline: correct_resp ~ 1 + (1 | PID) + (1 | target_object_code)
## fit.pres: correct_resp ~ condition + (1 | PID) + (1 | target_object_code)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## fit.pres_baseline 3 1273.6 1289.7 -633.81 1267.6
## fit.pres 5 1267.1 1293.8 -628.54 1257.1 10.536 2 0.005154 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(fit.pres, type = 3)
## Warning in printHypothesis(L, rhs, names(b)): one or more coefficients in the hypothesis include
## arithmetic operators in their names;
## the printed representation of the hypothesis will be omitted
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_resp
## Chisq Df Pr(>Chisq)
## (Intercept) 23.847 1 1.043e-06 ***
## condition 10.137 2 0.006292 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
emmeans(fit.pres,
specs = pairwise ~ "condition",
adjust = "tukey")
## $emmeans
## condition emmean SE df asymp.LCL asymp.UCL
## IGNORANCE 2.176 0.446 Inf 1.303 3.05
## B-3O 0.971 0.418 Inf 0.151 1.79
## B-2O 2.812 0.488 Inf 1.857 3.77
##
## Results are given on the logit (not the response) scale.
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df z.ratio p.value
## IGNORANCE - (B-3O) 1.205 0.565 Inf 2.131 0.0836
## IGNORANCE - (B-2O) -0.636 0.602 Inf -1.058 0.5405
## (B-3O) - (B-2O) -1.841 0.597 Inf -3.085 0.0058
##
## Results are given on the log odds ratio (not the response) scale.
## P value adjustment: tukey method for comparing a family of 3 estimates
session_info()
## ─ Session info ───────────────────────────────────────────────────────────────
## setting value
## version R version 4.4.1 (2024-06-14)
## os macOS Sonoma 14.5
## system aarch64, darwin20
## ui X11
## language (EN)
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz America/Los_Angeles
## date 2025-03-04
## pandoc 3.6.2 @ /opt/homebrew/bin/ (via rmarkdown)
## quarto 1.5.57 @ /usr/local/bin/quarto
##
## ─ Packages ───────────────────────────────────────────────────────────────────
## package * version date (UTC) lib source
## abind 1.4-5 2016-07-21 [1] CRAN (R 4.4.0)
## backports 1.5.0 2024-05-23 [1] CRAN (R 4.4.0)
## base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.4.0)
## boot 1.3-30 2024-02-26 [1] CRAN (R 4.4.1)
## bslib 0.8.0 2024-07-29 [1] CRAN (R 4.4.0)
## cachem 1.1.0 2024-05-16 [1] CRAN (R 4.4.0)
## car * 3.1-2 2023-03-30 [1] CRAN (R 4.4.0)
## carData * 3.0-5 2022-01-06 [1] CRAN (R 4.4.0)
## checkmate 2.3.1 2023-12-04 [1] CRAN (R 4.4.0)
## cli 3.6.3 2024-06-21 [1] CRAN (R 4.4.0)
## cluster 2.1.6 2023-12-01 [1] CRAN (R 4.4.1)
## coda 0.19-4.1 2024-01-31 [1] CRAN (R 4.4.0)
## colorspace 2.1-1 2024-07-26 [1] CRAN (R 4.4.0)
## data.table 1.15.4 2024-03-30 [1] CRAN (R 4.4.0)
## digest 0.6.37 2024-08-19 [1] CRAN (R 4.4.1)
## dplyr * 1.1.4 2023-11-17 [1] CRAN (R 4.4.0)
## emmeans * 1.10.3 2024-07-01 [1] CRAN (R 4.4.0)
## estimability 1.5.1 2024-05-12 [1] CRAN (R 4.4.0)
## evaluate 1.0.1 2024-10-10 [1] CRAN (R 4.4.1)
## fansi 1.0.6 2023-12-08 [1] CRAN (R 4.4.0)
## farver 2.1.2 2024-05-13 [1] CRAN (R 4.4.0)
## fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.0)
## forcats * 1.0.0 2023-01-29 [1] CRAN (R 4.4.0)
## foreign 0.8-86 2023-11-28 [1] CRAN (R 4.4.1)
## Formula 1.2-5 2023-02-24 [1] CRAN (R 4.4.0)
## generics 0.1.3 2022-07-05 [1] CRAN (R 4.4.0)
## ggplot2 * 3.5.1 2024-04-23 [1] CRAN (R 4.4.0)
## glue 1.8.0 2024-09-30 [1] CRAN (R 4.4.1)
## gridExtra 2.3 2017-09-09 [1] CRAN (R 4.4.0)
## gtable 0.3.5 2024-04-22 [1] CRAN (R 4.4.0)
## Hmisc 5.1-3 2024-05-28 [1] CRAN (R 4.4.0)
## hms 1.1.3 2023-03-21 [1] CRAN (R 4.4.0)
## htmlTable 2.4.3 2024-07-21 [1] CRAN (R 4.4.0)
## htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0)
## htmlwidgets 1.6.4 2023-12-06 [1] CRAN (R 4.4.0)
## jquerylib 0.1.4 2021-04-26 [1] CRAN (R 4.4.0)
## jsonlite 1.8.9 2024-09-20 [1] CRAN (R 4.4.1)
## knitr 1.49 2024-11-08 [1] CRAN (R 4.4.1)
## labeling 0.4.3 2023-08-29 [1] CRAN (R 4.4.0)
## lattice 0.22-6 2024-03-20 [1] CRAN (R 4.4.1)
## lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.0)
## lme4 * 1.1-35.5 2024-07-03 [1] CRAN (R 4.4.0)
## lubridate * 1.9.3 2023-09-27 [1] CRAN (R 4.4.0)
## magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.4.0)
## MASS 7.3-60.2 2024-04-26 [1] CRAN (R 4.4.1)
## Matrix * 1.7-0 2024-04-26 [1] CRAN (R 4.4.1)
## minqa 1.2.7 2024-05-20 [1] CRAN (R 4.4.0)
## munsell 0.5.1 2024-04-01 [1] CRAN (R 4.4.0)
## mvtnorm 1.2-5 2024-05-21 [1] CRAN (R 4.4.0)
## nlme 3.1-164 2023-11-27 [1] CRAN (R 4.4.1)
## nloptr 2.1.1 2024-06-25 [1] CRAN (R 4.4.0)
## nnet 7.3-19 2023-05-03 [1] CRAN (R 4.4.1)
## pillar 1.9.0 2023-03-22 [1] CRAN (R 4.4.0)
## pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.4.0)
## purrr * 1.0.2 2023-08-10 [1] CRAN (R 4.4.0)
## R6 2.5.1 2021-08-19 [1] CRAN (R 4.4.0)
## Rcpp 1.0.13 2024-07-17 [1] CRAN (R 4.4.0)
## readr * 2.1.5 2024-01-10 [1] CRAN (R 4.4.0)
## rlang 1.1.4 2024-06-04 [1] CRAN (R 4.4.0)
## rmarkdown 2.29 2024-11-04 [1] CRAN (R 4.4.1)
## rpart 4.1.23 2023-12-05 [1] CRAN (R 4.4.1)
## rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.4.0)
## sass 0.4.9 2024-03-15 [1] CRAN (R 4.4.0)
## scales 1.3.0 2023-11-28 [1] CRAN (R 4.4.0)
## sessioninfo * 1.2.3 2025-02-05 [1] CRAN (R 4.4.1)
## stringi 1.8.4 2024-05-06 [1] CRAN (R 4.4.0)
## stringr * 1.5.1 2023-11-14 [1] CRAN (R 4.4.0)
## tibble * 3.2.1 2023-03-20 [1] CRAN (R 4.4.0)
## tidyr * 1.3.1 2024-01-24 [1] CRAN (R 4.4.0)
## tidyselect 1.2.1 2024-03-11 [1] CRAN (R 4.4.0)
## tidyverse * 2.0.0 2023-02-22 [1] CRAN (R 4.4.0)
## timechange 0.3.0 2024-01-18 [1] CRAN (R 4.4.0)
## tzdb 0.4.0 2023-05-12 [1] CRAN (R 4.4.0)
## utf8 1.2.4 2023-10-22 [1] CRAN (R 4.4.0)
## vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.0)
## withr 3.0.1 2024-07-31 [1] CRAN (R 4.4.0)
## xfun 0.50 2025-01-07 [1] CRAN (R 4.4.1)
## xtable 1.8-4 2019-04-21 [1] CRAN (R 4.4.0)
## yaml 2.3.10 2024-07-26 [1] CRAN (R 4.4.0)
##
## [1] /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
## * ── Packages attached to the search path.
##
## ──────────────────────────────────────────────────────────────────────────────