df.response_exp1 <- read.csv("../../data/adults/PROCESSED_DATA/response.csv")
#check number of participants
df.response_exp1 %>%
group_by(PID) %>%
slice(1) %>%
nrow()
## [1] 36
df.demog_age <- df.response_exp1 %>%
group_by(PID) %>%
slice(1) %>%
ungroup()
df.demog_age_summary <- df.demog_age %>%
summarise(mean_age = mean(age, na.rm = T),
sd_age = sd(age, na.rm = T),
min_age = min(age, na.rm = T),
max_age = max(age, na.rm = T))
df.demog_age_summary_by_cond <- df.demog_age %>%
group_by(condition) %>%
summarise(mean_age = mean(age, na.rm = T),
sd_age = sd(age, na.rm = T),
min_age = min(age, na.rm = T),
max_age = max(age, na.rm = T))
df.demog_gender <- df.response_exp1 %>%
group_by(PID) %>%
slice(1) %>%
ungroup()
df.demog_gender_summary <- df.demog_gender %>%
group_by(gender) %>%
count()
df.demog_gender_summary_by_cond <- df.demog_gender %>%
group_by(condition, gender) %>%
count()
ggplot(df.response_exp1 %>%
group_by(PID, phase, trial_type) %>%
summarise(mean_select_many_same = mean(coded_resp, na.rm = T)),
aes(x = trial_type, y = mean_select_many_same, fill = phase)) +
geom_violin(alpha = 0.5) +
geom_jitter(alpha = 0.3,
height = 0) +
# geom_dotplot(binaxis = "y", stackdir = "center",
# alpha = 0.5,
# dotsize = 0.75) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
geom_hline(yintercept = 1/2, linetype = 'dashed') +
ylim(0, 1) +
labs(y = "Prop. Selecting Speaker with\nDifferent Objects or One Object") +
facet_grid(~phase) +
guides(fill="none") +
theme(text=element_text(size=18))
## `summarise()` has grouped output by 'PID', 'phase'. You can override using the
## `.groups` argument.
## Warning: Removed 5 rows containing non-finite outside the scale range
## (`stat_ydensity()`).
## Warning: Removed 5 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).
df.response_exp1_sum <- df.response_exp1 %>%
filter(block %in% c(1, 2)) %>%
mutate(condition = factor(condition, levels = c('2-OB', 'VP', '3-OB'))) %>%
group_by(PID, condition) %>%
summarise(mean_correct_resp_by_ppt = mean(correct_resp)) %>%
ungroup() %>%
group_by(condition) %>%
summarise(mean_correct_resp = mean(mean_correct_resp_by_ppt),
sd_correct_resp = sd(mean_correct_resp_by_ppt),
n = n()) %>%
mutate(se_correct_resp = sd_correct_resp / sqrt(n),
lower.ci.correct_resp = mean_correct_resp - qt(1 - (0.05 / 2), n - 1) * se_correct_resp,
upper.ci.correct_resp = mean_correct_resp + qt(1 - (0.05 / 2), n - 1) * se_correct_resp)
Random structure: by-participant and by-target-object random intercepts.
Model 1: choice of speaker (0/1) ~ 1 + (1|participant) + (1|object)
fit.knowledge_chance <- glmer(coded_resp ~ 1 + (1|PID) + (1|taught_cat),
data = df.response_exp1 %>%
filter(phase == "knowledge_judgment" & trial_type == "test"),
family = binomial(link = 'logit'),
control=glmerControl(optimizer="bobyqa",optCtrl=list(maxfun=100000)))
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge: degenerate Hessian with 1 negative eigenvalues
summary(fit.knowledge_chance) # did not converge
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: coded_resp ~ 1 + (1 | PID) + (1 | taught_cat)
## Data:
## df.response_exp1 %>% filter(phase == "knowledge_judgment" & trial_type ==
## "test")
## Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
##
## AIC BIC logLik deviance df.resid
## 17.2 24.0 -5.6 11.2 69
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -0.071611 0.000000 0.000000 0.000012 0.004208
##
## Random effects:
## Groups Name Variance Std.Dev.
## PID (Intercept) 4939 70.28
## taught_cat (Intercept) 3167 56.28
## Number of obs: 72, groups: PID, 36; taught_cat, 8
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 35.997540 0.009528 3778 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## optimizer (bobyqa) convergence code: 0 (OK)
## unable to evaluate scaled gradient
## Model failed to converge: degenerate Hessian with 1 negative eigenvalues
fit.label_chance <- glmer(coded_resp ~ 1 + (1|PID) + (1|taught_cat),
data = df.response_exp1 %>%
filter(phase == "label_endorsement" & trial_type == "test"),
family = binomial(link = 'logit'),
control=glmerControl(optimizer="bobyqa",optCtrl=list(maxfun=100000)))
summary(fit.label_chance)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: coded_resp ~ 1 + (1 | PID) + (1 | taught_cat)
## Data:
## df.response_exp1 %>% filter(phase == "label_endorsement" & trial_type ==
## "test")
## Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
##
## AIC BIC logLik deviance df.resid
## 88.7 95.2 -41.3 82.7 62
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.4306 -1.1446 0.5667 0.6393 0.7951
##
## Random effects:
## Groups Name Variance Std.Dev.
## PID (Intercept) 0.53557 0.7318
## taught_cat (Intercept) 0.06401 0.2530
## Number of obs: 65, groups: PID, 34; taught_cat, 4
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.7949 0.3893 2.042 0.0412 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Model 2: choice of speaker (0/1) ~ Trial Type (Control / Test) + (1|participant) + (1|object)
fit.knowledge_cond_compare <- glmer(coded_resp ~ trial_type + (1|PID) + (1|taught_cat),
data = df.response_exp1 %>%
filter(phase == "knowledge_judgment"),
family = binomial(link = 'logit'),
control=glmerControl(optimizer="bobyqa",optCtrl=list(maxfun=100000)))
summary(fit.knowledge_cond_compare) # did not converge
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: coded_resp ~ trial_type + (1 | PID) + (1 | taught_cat)
## Data: df.response_exp1 %>% filter(phase == "knowledge_judgment")
## Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
##
## AIC BIC logLik deviance df.resid
## 127.6 139.5 -59.8 119.6 140
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.5873 -0.6553 0.1792 0.2137 1.3809
##
## Random effects:
## Groups Name Variance Std.Dev.
## PID (Intercept) 0.2217 0.4709
## taught_cat (Intercept) 0.2053 0.4531
## Number of obs: 144, groups: PID, 36; taught_cat, 16
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.5731 0.3273 -1.751 0.0799 .
## trial_typetest 3.8954 0.8045 4.842 1.29e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## tril_typtst -0.503
fit.label_cond_compare <- glmer(coded_resp ~ trial_type + (1|PID) + (1|taught_cat),
data = df.response_exp1 %>%
filter(phase == "label_endorsement"),
family = binomial(link = 'logit'),
control=glmerControl(optimizer="bobyqa",optCtrl=list(maxfun=100000)))
## boundary (singular) fit: see help('isSingular')
summary(fit.label_cond_compare) # did not converge
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: coded_resp ~ trial_type + (1 | PID) + (1 | taught_cat)
## Data: df.response_exp1 %>% filter(phase == "label_endorsement")
## Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
##
## AIC BIC logLik deviance df.resid
## 180.6 192.0 -86.3 172.6 126
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.3981 -0.8975 0.7153 0.7153 1.1142
##
## Random effects:
## Groups Name Variance Std.Dev.
## PID (Intercept) 0 0
## taught_cat (Intercept) 0 0
## Number of obs: 130, groups: PID, 34; taught_cat, 4
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.2162 0.2495 -0.867 0.3862
## trial_typetest 0.8864 0.3619 2.449 0.0143 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## tril_typtst -0.689
## optimizer (bobyqa) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
session_info()
## ─ Session info ───────────────────────────────────────────────────────────────
## setting value
## version R version 4.4.1 (2024-06-14)
## os macOS 26.3.1
## system aarch64, darwin20
## ui X11
## language (EN)
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz America/Los_Angeles
## date 2026-05-07
## pandoc 3.8.3 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/aarch64/ (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)
## bayestestR 0.17.0 2025-08-29 [1] CRAN (R 4.4.1)
## boot 1.3-30 2024-02-26 [1] CRAN (R 4.4.1)
## bslib 0.9.0 2025-01-30 [1] CRAN (R 4.4.1)
## 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.2 2024-07-29 [1] CRAN (R 4.4.0)
## cli 3.6.5 2025-04-23 [1] CRAN (R 4.4.1)
## 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.17.2 2025-05-12 [1] CRAN (R 4.4.1)
## datawizard 1.3.0 2025-10-11 [1] CRAN (R 4.4.1)
## 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)
## effectsize 0.8.9 2024-07-03 [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.3 2025-01-10 [1] CRAN (R 4.4.1)
## 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.4 2025-05-09 [1] CRAN (R 4.4.1)
## ggplot2 * 3.5.2 2025-04-09 [1] CRAN (R 4.4.1)
## 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.6 2024-10-25 [1] CRAN (R 4.4.1)
## Hmisc 5.2-3 2025-03-16 [1] CRAN (R 4.4.1)
## 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)
## insight 1.4.2 2025-09-02 [1] CRAN (R 4.4.1)
## jquerylib 0.1.4 2021-04-26 [1] CRAN (R 4.4.0)
## jsonlite 2.0.0 2025-03-27 [1] CRAN (R 4.4.1)
## knitr 1.50 2025-03-16 [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)
## mclogit * 0.9.15 2025-12-16 [1] CRAN (R 4.4.3)
## memisc * 0.99.31.8.3 2025-04-14 [1] CRAN (R 4.4.1)
## minqa 1.2.7 2024-05-20 [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-20 2025-01-01 [1] CRAN (R 4.4.1)
## papaja * 0.1.3 2024-10-24 [1] CRAN (R 4.4.1)
## parameters 0.28.2 2025-09-10 [1] CRAN (R 4.4.1)
## pillar 1.10.2 2025-04-05 [1] CRAN (R 4.4.1)
## 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.6.1 2025-02-15 [1] CRAN (R 4.4.1)
## RColorBrewer 1.1-3 2022-04-03 [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)
## report * 0.5.9 2024-07-10 [1] CRAN (R 4.4.0)
## rlang 1.1.6 2025-04-11 [1] CRAN (R 4.4.1)
## 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.17.1 2024-10-22 [1] CRAN (R 4.4.1)
## sass 0.4.10 2025-04-11 [1] CRAN (R 4.4.1)
## scales 1.4.0 2025-04-24 [1] CRAN (R 4.4.1)
## sessioninfo * 1.2.3 2025-02-05 [1] CRAN (R 4.4.1)
## stringi 1.8.7 2025-03-27 [1] CRAN (R 4.4.1)
## 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)
## tinylabels * 0.2.4 2023-09-02 [1] CRAN (R 4.4.0)
## tzdb 0.4.0 2023-05-12 [1] CRAN (R 4.4.0)
## vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.0)
## withr 3.0.2 2024-10-28 [1] CRAN (R 4.4.1)
## xfun 0.52 2025-04-02 [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.
##
## ──────────────────────────────────────────────────────────────────────────────