df.ppt_raw <- read.csv('../../../data/exp1/PROCESSED_DATA/exp1_ppt.csv')
df.trial_raw <- read.csv('../../../data/exp1/PROCESSED_DATA/exp1_trial.csv')
#exclusions go here (or in a separate thing)
# exclude participants who missed more than 1 trial (completed fewer than 5)
ppt_excluded_completion <- df.trial_raw %>%
filter(is.na(count)) %>%
group_by(id) %>%
summarise(n_no_count = n()) %>%
filter(n_no_count > 1) %>%
pull(id)
df.ppt <- df.ppt_raw %>%
filter(!id %in% ppt_excluded_completion)
exclude <- df.trial_raw %>%
filter(exclude == "Y") %>%
count() %>%
pull(n)
df.trial <- df.trial_raw %>%
filter(!id %in% ppt_excluded_completion) %>%
filter(exclude != "Y")
df.trial <- df.trial %>%
mutate(knower_level_cp_subset = factor(knower_level_cp_subset, levels = c("subset", "CP")),
magnitude = factor(magnitude, levels = c("small", "large")))
df.ppt_knower_level <- df.ppt %>%
count(knower_level_cp_subset)
df.ppt_knower_level_gender <- df.ppt %>%
count(knower_level_cp_subset, gender)
df.ppt_summary <- df.ppt %>%
group_by(knower_level_cp_subset) %>%
summarise(mean_age = mean(age_years_cont),
sd_age = sd(age_years_cont),
min_age = min(age_years_cont),
max_age = max(age_years_cont))
df.ppt %>%
count(age_years) %>%
knitr::kable()
age_years | n |
---|---|
2 | 8 |
3 | 25 |
4 | 34 |
5 | 15 |
df.ppt %>%
count(gender) %>%
knitr::kable()
gender | n |
---|---|
F | 48 |
M | 34 |
df.ppt %>%
count(knower_level_cp_subset, age_years) %>%
knitr::kable()
knower_level_cp_subset | age_years | n |
---|---|---|
CP | 3 | 7 |
CP | 4 | 24 |
CP | 5 | 13 |
subset | 2 | 8 |
subset | 3 | 18 |
subset | 4 | 10 |
subset | 5 | 2 |
df.ppt %>%
count(knower_level_cp_subset, gender) %>%
knitr::kable()
knower_level_cp_subset | gender | n |
---|---|---|
CP | F | 25 |
CP | M | 19 |
subset | F | 23 |
subset | M | 15 |
df.ppt %>%
group_by(knower_level_cp_subset) %>%
summarise(min_age = min(age_months),
max_age = max(age_months),
mean_age = mean(age_years_cont),
sd_age = sd(age_years_cont))
## # A tibble: 2 × 5
## knower_level_cp_subset min_age max_age mean_age sd_age
## <chr> <int> <int> <dbl> <dbl>
## 1 CP 36 71 4.63 0.647
## 2 subset 25 62 3.55 0.755
How many kids did not count?
response_without_counting <- df.trial %>%
filter(!is.na(count) & is.na(set_chosen)) %>%
group_by(knower_level_cp_subset, magnitude) %>%
count()
response_without_counting
## # A tibble: 4 × 3
## # Groups: knower_level_cp_subset, magnitude [4]
## knower_level_cp_subset magnitude n
## <fct> <fct> <int>
## 1 subset small 43
## 2 subset large 40
## 3 CP small 14
## 4 CP large 11
Combining both overt set selection and correct counting (participants are correct if they’ve selected the correct set, or counted correctly.)
df.summary_knower_level_correct_set_chosen <- df.trial %>%
group_by(knower_level_cp_subset) %>%
summarise(mean = mean(correct_set_chosen), sd = sd(correct_set_chosen))
df.summary_knower_level_correct_set_chosen
## # A tibble: 2 × 3
## knower_level_cp_subset mean sd
## <fct> <dbl> <dbl>
## 1 subset 0.487 0.501
## 2 CP 0.882 0.324
df.summary_magnitude_correct_set_chosen <- df.trial %>%
group_by(magnitude) %>%
summarise(mean = mean(correct_set_chosen), sd = sd(correct_set_chosen))
df.summary_magnitude_correct_set_chosen
## # A tibble: 2 × 3
## magnitude mean sd
## <fct> <dbl> <dbl>
## 1 small 0.710 0.455
## 2 large 0.686 0.465
df.summary_magnitude_correct_set_chosen <- df.trial %>%
group_by(magnitude) %>%
summarise(mean = mean(correct_set_chosen), sd = sd(correct_set_chosen))
df.summary_magnitude_correct_set_chosen
## # A tibble: 2 × 3
## magnitude mean sd
## <fct> <dbl> <dbl>
## 1 small 0.710 0.455
## 2 large 0.686 0.465
Doesn’t seem to be any differences between small and large sets, only between CP and subset knowers.
ggplot(data = df.trial,
mapping = aes(x = knower_level_cp_subset, y = correct_set_chosen)) +
geom_jitter(aes(color = id),
height = 0,
alpha = 0.5) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
facet_grid(~ magnitude) +
theme(legend.position = "none")
ggplot(data = df.trial,
mapping = aes(x = age_years, y = correct_set_chosen)) +
geom_jitter(aes(color = id),
height = 0,
alpha = 0.5) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
theme(legend.position = "none")
ggplot(data = df.trial,
mapping = aes(x = knower_level_cp_subset, y = correct_set_chosen, fill = knower_level_cp_subset)) +
geom_jitter(aes(group = id),
height = 0,
alpha = 0.5) +
geom_bar(stat = "summary",
fun.y = "mean") +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
geom_jitter(aes(group = id),
height = 0,
alpha = 0.3) +
facet_grid(magnitude ~ age_years) +
theme(legend.position = "none") +
labs(y = "Cardinal extension success (by trial)",
x = "Knower Level")
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
Each dot is a participant. Accurracy in set chosen against age (years, continuous) looks linear.
plot1 <- ggplot(data = df.trial %>%
mutate(magnitude = factor(magnitude, levels = c("small", "large"), labels = c("small sets", "large sets")),
knower_level_cp_subset = factor(knower_level_cp_subset, levels = c("subset", "CP"))) %>%
group_by(id, magnitude, knower_level_cp_subset) %>%
summarise(mean_correct_set_chosen = mean(correct_set_chosen, na.rm = TRUE)),
mapping = aes(x = knower_level_cp_subset, y = mean_correct_set_chosen)) +
geom_violin(aes(fill = knower_level_cp_subset)) +
geom_jitter(height = 0,
alpha = 0.5) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
facet_grid(~ magnitude) +
scale_fill_manual(values=cbPalette) +
geom_hline(yintercept = 0.5, linetype = 2) +
theme(legend.position = "none") +
labs(y = "Prop. of correct set choice",
x = "Knower Level")
## `summarise()` has grouped output by 'id', 'magnitude'. You can override using
## the `.groups` argument.
ggplot(data = df.trial %>%
group_by(id, magnitude, knower_level_cp_subset, age_years_cont) %>%
summarise(mean_correct_set_chosen = mean(correct_set_chosen, na.rm = TRUE)),
mapping = aes(x = age_years_cont, y = mean_correct_set_chosen)) +
geom_point()+
geom_smooth(method='lm') +
theme(legend.position = "none")
## `summarise()` has grouped output by 'id', 'magnitude',
## 'knower_level_cp_subset'. You can override using the `.groups` argument.
## `geom_smooth()` using formula = 'y ~ x'
ggplot(data = df.trial %>%
mutate(knower_level_cp_subset = factor(knower_level_cp_subset, levels = c("subset", "CP")))%>%
mutate(magnitude = factor(magnitude, levels = c("small", "large"), labels = c("small sets", "large sets"))) %>%
group_by(id, magnitude, knower_level_cp_subset, age_years_cont) %>%
summarise(mean_correct_set_chosen = mean(correct_set_chosen, na.rm = TRUE)),
mapping = aes(x = age_years_cont, y = mean_correct_set_chosen,
color = knower_level_cp_subset)) +
geom_jitter(height = 0,
alpha = 0.5) +
facet_grid(~magnitude) +
ylim(0, 1) +
geom_smooth(method='lm', aes(fill = knower_level_cp_subset)) +
scale_fill_manual(values=cbPalette) +
scale_color_manual(values=cbPalette) +
labs(x = "Age (years)",
y = "Prop. of correct set choice",
fill = "",
color = "") +
geom_hline(yintercept = 0.5, linetype = "dashed") +
theme(text = element_text(size=13),
legend.position="none")
## `summarise()` has grouped output by 'id', 'magnitude',
## 'knower_level_cp_subset'. You can override using the `.groups` argument.
## `geom_smooth()` using formula = 'y ~ x'
ggplot(data = df.trial %>%
filter(knower_level_cp_subset == "CP") %>%
group_by(id, magnitude, knower_level_cp_subset) %>%
summarise(mean_correct_set_chosen = mean(correct_set_chosen, na.rm = TRUE)),
mapping = aes(x = knower_level_cp_subset, y = mean_correct_set_chosen)) +
geom_violin(aes(fill = knower_level_cp_subset)) +
geom_jitter(height = 0,
alpha = 0.5) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
facet_grid(~ magnitude) +
theme(legend.position = "none") +
labs(y = "Mean cardinal extension success (by participant)",
x = "Knower Level")
## `summarise()` has grouped output by 'id', 'magnitude'. You can override using
## the `.groups` argument.
Only 65% of CP-knowers were above chance (following binomial p < .05 –> chose correctly at least 5 out of 6 trials).
df.trial_summary <- df.trial %>%
group_by(id, knower_level_cp_subset) %>%
summarise(mean_correct_set = mean(correct_set_chosen, na.rm = TRUE)) %>%
group_by(knower_level_cp_subset) %>%
summarise(n_total = n(),
n_succeed = length(id[mean_correct_set == 6/6]),
prop_succeed =n_succeed / n_total)
## `summarise()` has grouped output by 'id'. You can override using the `.groups`
## argument.
df.trial_summary
## # A tibble: 2 × 4
## knower_level_cp_subset n_total n_succeed prop_succeed
## <fct> <int> <int> <dbl>
## 1 subset 38 4 0.105
## 2 CP 44 26 0.591
t.test(df.trial %>%
filter(knower_level_cp_subset == "subset") %>%
pull(correct_set_chosen),
mu = 0.5)
##
## One Sample t-test
##
## data: df.trial %>% filter(knower_level_cp_subset == "subset") %>% pull(correct_set_chosen)
## t = -0.39662, df = 227, p-value = 0.692
## alternative hypothesis: true mean is not equal to 0.5
## 95 percent confidence interval:
## 0.4214724 0.5522118
## sample estimates:
## mean of x
## 0.4868421
#$statistic
#$parameter
#$p.values
report(t.test(df.trial %>%
filter(knower_level_cp_subset == "CP") %>%
pull(correct_set_chosen),
mu = 0.5))
## Effect sizes were labelled following Cohen's (1988) recommendations.
##
## The One Sample t-test testing the difference between df.trial %>%
## filter(knower_level_cp_subset == "CP") %>% pull(correct_set_chosen) (mean =
## 0.88) and mu = 0.5 suggests that the effect is positive, statistically
## significant, and large (difference = 0.38, 95% CI [0.84, 0.92], t(261) = 19.09,
## p < .001; Cohen's d = 1.18, 95% CI [1.02, 1.34])
report(t.test(df.trial %>%
filter(magnitude == "small") %>%
pull(correct_set_chosen),
mu = 0.5))
## Effect sizes were labelled following Cohen's (1988) recommendations.
##
## The One Sample t-test testing the difference between df.trial %>%
## filter(magnitude == "small") %>% pull(correct_set_chosen) (mean = 0.71) and mu
## = 0.5 suggests that the effect is positive, statistically significant, and
## small (difference = 0.21, 95% CI [0.65, 0.77], t(244) = 7.24, p < .001; Cohen's
## d = 0.46, 95% CI [0.33, 0.59])
report(t.test(df.trial %>%
filter(magnitude == "large") %>%
pull(correct_set_chosen),
mu = 0.5))
## Effect sizes were labelled following Cohen's (1988) recommendations.
##
## The One Sample t-test testing the difference between df.trial %>%
## filter(magnitude == "large") %>% pull(correct_set_chosen) (mean = 0.69) and mu
## = 0.5 suggests that the effect is positive, statistically significant, and
## small (difference = 0.19, 95% CI [0.63, 0.74], t(244) = 6.25, p < .001; Cohen's
## d = 0.40, 95% CI [0.27, 0.53])
report(t.test(df.trial %>%
filter(knower_level_cp_subset == "CP", magnitude == "small") %>%
pull(correct_set_chosen),
df.trial %>%
filter(knower_level_cp_subset == "subset", magnitude == "small") %>%
pull(correct_set_chosen)))
## Effect sizes were labelled following Cohen's (1988) recommendations.
##
## The Welch Two Sample t-test testing the difference between df.trial %>%
## filter(knower_level_cp_subset == "CP", magnitude == "small") %>%
## pull(correct_set_chosen) and df.trial %>% filter(knower_level_cp_subset ==
## "subset", magnitude == "small") %>% pull(correct_set_chosen) (mean of x = 0.89,
## mean of y = 0.51) suggests that the effect is positive, statistically
## significant, and large (difference = 0.38, 95% CI [0.27, 0.48], t(186.58) =
## 6.89, p < .001; Cohen's d = 0.90, 95% CI [0.62, 1.16])
report(t.test(df.trial %>%
filter(knower_level_cp_subset == "CP", magnitude == "large") %>%
pull(correct_set_chosen),
df.trial %>%
filter(knower_level_cp_subset == "subset", magnitude == "large") %>%
pull(correct_set_chosen)))
## Effect sizes were labelled following Cohen's (1988) recommendations.
##
## The Welch Two Sample t-test testing the difference between df.trial %>%
## filter(knower_level_cp_subset == "CP", magnitude == "large") %>%
## pull(correct_set_chosen) and df.trial %>% filter(knower_level_cp_subset ==
## "subset", magnitude == "large") %>% pull(correct_set_chosen) (mean of x = 0.88,
## mean of y = 0.46) suggests that the effect is positive, statistically
## significant, and large (difference = 0.41, 95% CI [0.30, 0.52], t(190.31) =
## 7.51, p < .001; Cohen's d = 0.97, 95% CI [0.70, 1.25])
correct_set_chosen ~ magnitude + age_zscored + (1|id) + (1|quantity) Effect of age
#registered
#only age has an effect
#z-scored age based on previous work
fit.base <- glmer(correct_set_chosen ~ magnitude + age_zscored + (1|id)
+ (1|trial_ratio)
,
data = df.trial, family="binomial")
summary(fit.base)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: correct_set_chosen ~ magnitude + age_zscored + (1 | id) + (1 |
## trial_ratio)
## Data: df.trial
##
## AIC BIC logLik deviance df.resid
## 447.7 468.6 -218.8 437.7 485
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.1758 -0.3410 0.2042 0.4373 2.3373
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 2.34536 1.5315
## trial_ratio (Intercept) 0.01173 0.1083
## Number of obs: 490, groups: id, 82; trial_ratio, 6
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.4818 0.2905 5.101 3.39e-07 ***
## magnitudelarge -0.1863 0.2787 -0.668 0.504
## age_zscored 1.6667 0.2670 6.241 4.34e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) mgntdl
## magnitudlrg -0.505
## age_zscored 0.245 -0.030
report(fit.base)
## We fitted a logistic mixed model (estimated using ML and Nelder-Mead optimizer)
## to predict correct_set_chosen with magnitude and age_zscored (formula:
## correct_set_chosen ~ magnitude + age_zscored). The model included id as random
## effects (formula: list(~1 | id, ~1 | trial_ratio)). The model's total
## explanatory power is substantial (conditional R2 = 0.60) and the part related
## to the fixed effects alone (marginal R2) is of 0.32. The model's intercept,
## corresponding to magnitude = small and age_zscored = 0, is at 1.48 (95% CI
## [0.91, 2.05], p < .001). Within this model:
##
## - The effect of magnitude [large] is statistically non-significant and negative
## (beta = -0.19, 95% CI [-0.73, 0.36], p = 0.504; Std. beta = -0.19, 95% CI
## [-0.73, 0.36])
## - The effect of age zscored is statistically significant and positive (beta =
## 1.67, 95% CI [1.14, 2.19], p < .001; Std. beta = 1.63, 95% CI [1.12, 2.14])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald z-distribution approximation.
Anova(fit.base, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 26.0151 1 3.388e-07 ***
## magnitude 0.4468 1 0.5039
## age_zscored 38.9547 1 4.337e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#not-registered
#split by knower level
fit.base_cp <- glmer(correct_set_chosen ~ magnitude + age_zscored + (1|id)
+ (1|trial_ratio)
,
data = df.trial %>% filter(knower_level_cp_subset == "CP"),
family="binomial")
summary(fit.base_cp)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: correct_set_chosen ~ magnitude + age_zscored + (1 | id) + (1 |
## trial_ratio)
## Data: df.trial %>% filter(knower_level_cp_subset == "CP")
##
## AIC BIC logLik deviance df.resid
## 182.0 199.9 -86.0 172.0 257
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.1580 0.1596 0.1903 0.3250 0.9317
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 2.6320 1.6223
## trial_ratio (Intercept) 0.1366 0.3696
## Number of obs: 262, groups: id, 44; trial_ratio, 6
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.56597 0.60645 4.231 2.33e-05 ***
## magnitudelarge -0.05988 0.53585 -0.112 0.911
## age_zscored 0.60842 0.48544 1.253 0.210
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) mgntdl
## magnitudlrg -0.461
## age_zscored -0.290 0.009
Anova(fit.base_cp, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 17.9026 1 2.325e-05 ***
## magnitude 0.0125 1 0.9110
## age_zscored 1.5708 1 0.2101
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
fit.base_subset <- glmer(correct_set_chosen ~ magnitude + age_zscored + (1|id)
#+ (1|trial_ratio)
,
data = df.trial %>% filter(knower_level_cp_subset == "subset"),
family="binomial")
summary(fit.base_subset)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: correct_set_chosen ~ magnitude + age_zscored + (1 | id)
## Data: df.trial %>% filter(knower_level_cp_subset == "subset")
##
## AIC BIC logLik deviance df.resid
## 261.7 275.4 -126.8 253.7 224
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.8409 -0.5656 -0.2853 0.6255 2.5524
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 1.416 1.19
## Number of obs: 228, groups: id, 38
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.0252 0.3847 2.665 0.0077 **
## magnitudelarge -0.2745 0.3325 -0.826 0.4090
## age_zscored 1.5554 0.3575 4.351 1.36e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) mgntdl
## magnitudlrg -0.455
## age_zscored 0.596 -0.045
report(fit.base_subset)
## We fitted a logistic mixed model (estimated using ML and Nelder-Mead optimizer)
## to predict correct_set_chosen with magnitude and age_zscored (formula:
## correct_set_chosen ~ magnitude + age_zscored). The model included id as random
## effect (formula: ~1 | id). The model's total explanatory power is substantial
## (conditional R2 = 0.49) and the part related to the fixed effects alone
## (marginal R2) is of 0.27. The model's intercept, corresponding to magnitude =
## small and age_zscored = 0, is at 1.03 (95% CI [0.27, 1.78], p = 0.008). Within
## this model:
##
## - The effect of magnitude [large] is statistically non-significant and negative
## (beta = -0.27, 95% CI [-0.93, 0.38], p = 0.409; Std. beta = -0.27, 95% CI
## [-0.93, 0.38])
## - The effect of age zscored is statistically significant and positive (beta =
## 1.56, 95% CI [0.85, 2.26], p < .001; Std. beta = 1.30, 95% CI [0.71, 1.88])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald z-distribution approximation.
Anova(fit.base_subset, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 7.1016 1 0.007702 **
## magnitude 0.6818 1 0.408975
## age_zscored 18.9269 1 1.358e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
correct_set_chosen ~ knower_level_cp_subset + magnitude + (1|id) + (1|trial_ratio) Effect of knower level, no effect of magnitude. ??? Model failed to converge: Probably need to take out trial_ratio as a random effect? Maybe it’s correlating too much with magnitude.
#not registered
fit.cp <- glmer(correct_set_chosen ~ knower_level_cp_subset + magnitude + (1|id) + (1|trial_ratio), data = df.trial, family="binomial")
summary(fit.cp)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: correct_set_chosen ~ knower_level_cp_subset + magnitude + (1 |
## id) + (1 | trial_ratio)
## Data: df.trial
##
## AIC BIC logLik deviance df.resid
## 457.8 478.7 -223.9 447.8 485
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9939 -0.3678 0.1882 0.3846 1.9260
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 2.85493 1.6897
## trial_ratio (Intercept) 0.01367 0.1169
## Number of obs: 490, groups: id, 82; trial_ratio, 6
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.009696 0.358321 -0.027 0.978
## knower_level_cp_subsetCP 2.982294 0.533832 5.587 2.32e-08 ***
## magnitudelarge -0.193643 0.280654 -0.690 0.490
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) k___CP
## knwr_lv__CP -0.563
## magnitudlrg -0.390 -0.029
report(fit.cp)
## We fitted a logistic mixed model (estimated using ML and Nelder-Mead optimizer)
## to predict correct_set_chosen with knower_level_cp_subset and magnitude
## (formula: correct_set_chosen ~ knower_level_cp_subset + magnitude). The model
## included id as random effects (formula: list(~1 | id, ~1 | trial_ratio)). The
## model's total explanatory power is substantial (conditional R2 = 0.61) and the
## part related to the fixed effects alone (marginal R2) is of 0.27. The model's
## intercept, corresponding to knower_level_cp_subset = subset and magnitude =
## small, is at -9.70e-03 (95% CI [-0.71, 0.69], p = 0.978). Within this model:
##
## - The effect of knower level cp subset [CP] is statistically significant and
## positive (beta = 2.98, 95% CI [1.94, 4.03], p < .001; Std. beta = 2.98, 95% CI
## [1.94, 4.03])
## - The effect of magnitude [large] is statistically non-significant and negative
## (beta = -0.19, 95% CI [-0.74, 0.36], p = 0.490; Std. beta = -0.19, 95% CI
## [-0.74, 0.36])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald z-distribution approximation.
Anova(fit.cp, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 0.0007 1 0.9784
## knower_level_cp_subset 31.2099 1 2.316e-08 ***
## magnitude 0.4761 1 0.4902
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(fit.cp, fit.base, type = 3)
## Data: df.trial
## Models:
## fit.cp: correct_set_chosen ~ knower_level_cp_subset + magnitude + (1 | id) + (1 | trial_ratio)
## fit.base: correct_set_chosen ~ magnitude + age_zscored + (1 | id) + (1 | trial_ratio)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## fit.cp 5 457.77 478.74 -223.88 447.77
## fit.base 5 447.67 468.64 -218.83 437.67 10.099 0
correct_set_chosen ~ knower_level_cp_subset + magnitude + age_zscored + (1|id) + (1|trial_ratio) Effect of age, no effect of KL or magnitude. Model fail to converge
# knower level effect is wiped out by age effects
fit.cp_age <- glmer(correct_set_chosen ~ age_zscored + magnitude + knower_level_cp_subset + (1|id)
+ (1|trial_ratio)
, data = df.trial, family="binomial")
summary(fit.cp_age)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## correct_set_chosen ~ age_zscored + magnitude + knower_level_cp_subset +
## (1 | id) + (1 | trial_ratio)
## Data: df.trial
##
## AIC BIC logLik deviance df.resid
## 442.7 467.8 -215.3 430.7 484
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.4014 -0.3459 0.1920 0.3955 2.2877
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 2.00334 1.4154
## trial_ratio (Intercept) 0.01384 0.1176
## Number of obs: 490, groups: id, 82; trial_ratio, 6
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.7338 0.3733 1.966 0.04933 *
## age_zscored 1.1772 0.2909 4.047 5.2e-05 ***
## magnitudelarge -0.1891 0.2814 -0.672 0.50148
## knower_level_cp_subsetCP 1.4329 0.5434 2.637 0.00836 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) ag_zsc mgntdl
## age_zscored 0.485
## magnitudlrg -0.383 -0.016
## knwr_lv__CP -0.660 -0.498 -0.017
report(fit.cp_age)
## We fitted a logistic mixed model (estimated using ML and Nelder-Mead optimizer)
## to predict correct_set_chosen with age_zscored, magnitude and
## knower_level_cp_subset (formula: correct_set_chosen ~ age_zscored + magnitude +
## knower_level_cp_subset). The model included id as random effects (formula:
## list(~1 | id, ~1 | trial_ratio)). The model's total explanatory power is
## substantial (conditional R2 = 0.60) and the part related to the fixed effects
## alone (marginal R2) is of 0.35. The model's intercept, corresponding to
## age_zscored = 0, magnitude = small and knower_level_cp_subset = subset, is at
## 0.73 (95% CI [2.14e-03, 1.47], p = 0.049). Within this model:
##
## - The effect of age zscored is statistically significant and positive (beta =
## 1.18, 95% CI [0.61, 1.75], p < .001; Std. beta = 1.15, 95% CI [0.59, 1.71])
## - The effect of magnitude [large] is statistically non-significant and negative
## (beta = -0.19, 95% CI [-0.74, 0.36], p = 0.501; Std. beta = -0.19, 95% CI
## [-0.74, 0.36])
## - The effect of knower level cp subset [CP] is statistically significant and
## positive (beta = 1.43, 95% CI [0.37, 2.50], p = 0.008; Std. beta = 1.43, 95% CI
## [0.37, 2.50])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald z-distribution approximation.
Anova(fit.cp_age, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 3.8639 1 0.049334 *
## age_zscored 16.3749 1 5.197e-05 ***
## magnitude 0.4518 1 0.501482
## knower_level_cp_subset 6.9541 1 0.008363 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(fit.cp_age, fit.base, type=3)
## Data: df.trial
## Models:
## fit.base: correct_set_chosen ~ magnitude + age_zscored + (1 | id) + (1 | trial_ratio)
## fit.cp_age: correct_set_chosen ~ age_zscored + magnitude + knower_level_cp_subset + (1 | id) + (1 | trial_ratio)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## fit.base 5 447.67 468.64 -218.83 437.67
## fit.cp_age 6 442.68 467.85 -215.34 430.68 6.9848 1 0.008221 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
correct_set_chosen ~ knower_level_cp_subset * magnitude + (1|id) + (1|trial_ratio) Effect of KL, no interaction.
#not registered
fit.cp_int <- glmer(correct_set_chosen ~ knower_level_cp_subset * magnitude + (1|id) + (1|trial_ratio), data = df.trial, family="binomial")
summary(fit.cp_int)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: correct_set_chosen ~ knower_level_cp_subset * magnitude + (1 |
## id) + (1 | trial_ratio)
## Data: df.trial
##
## AIC BIC logLik deviance df.resid
## 459.6 484.8 -223.8 447.6 484
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.8822 -0.3746 0.1822 0.3719 1.9661
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 2.86191 1.6917
## trial_ratio (Intercept) 0.01305 0.1142
## Number of obs: 490, groups: id, 82; trial_ratio, 6
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.02977 0.37190 0.080 0.936
## knower_level_cp_subsetCP 2.87228 0.59903 4.795 1.63e-06
## magnitudelarge -0.27287 0.34415 -0.793 0.428
## knower_level_cp_subsetCP:magnitudelarge 0.21754 0.54793 0.397 0.691
##
## (Intercept)
## knower_level_cp_subsetCP ***
## magnitudelarge
## knower_level_cp_subsetCP:magnitudelarge
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) kn___CP mgntdl
## knwr_lv__CP -0.608
## magnitudlrg -0.460 0.248
## knwr_l__CP: 0.268 -0.453 -0.582
Anova(fit.cp_int, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 0.0064 1 0.9362
## knower_level_cp_subset 22.9911 1 1.628e-06 ***
## magnitude 0.6287 1 0.4278
## knower_level_cp_subset:magnitude 0.1576 1 0.6914
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
correct_set_chosen ~ knower_level_cp_subset * magnitude + age_zscored + (1|id) + (1|trial_ratio) Effect of age, no effect of KL or magnitude or interaction.
fit.cp_age_int <- glmer(correct_set_chosen ~ age_zscored + magnitude * knower_level_cp_subset + (1|id)
+ (1|trial_ratio)
,
data = df.trial,
family="binomial")
summary(fit.cp_age_int)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## correct_set_chosen ~ age_zscored + magnitude * knower_level_cp_subset +
## (1 | id) + (1 | trial_ratio)
## Data: df.trial
##
## AIC BIC logLik deviance df.resid
## 444.5 473.9 -215.2 430.5 483
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.2740 -0.3457 0.1915 0.4008 2.3419
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 2.0084 1.4172
## trial_ratio (Intercept) 0.0132 0.1149
## Number of obs: 490, groups: id, 82; trial_ratio, 6
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.7795 0.3883 2.008 0.0447
## age_zscored 1.1794 0.2913 4.049 5.13e-05
## magnitudelarge -0.2780 0.3473 -0.800 0.4234
## knower_level_cp_subsetCP 1.3098 0.6109 2.144 0.0320
## magnitudelarge:knower_level_cp_subsetCP 0.2380 0.5464 0.436 0.6631
##
## (Intercept) *
## age_zscored ***
## magnitudelarge
## knower_level_cp_subsetCP *
## magnitudelarge:knower_level_cp_subsetCP
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) ag_zsc mgntdl k___CP
## age_zscored 0.474
## magnitudlrg -0.458 -0.029
## knwr_lv__CP -0.693 -0.455 0.264
## mgntd:___CP 0.273 0.024 -0.589 -0.456
report(fit.cp_age_int)
## We fitted a logistic mixed model (estimated using ML and Nelder-Mead optimizer)
## to predict correct_set_chosen with age_zscored, magnitude and
## knower_level_cp_subset (formula: correct_set_chosen ~ age_zscored + magnitude *
## knower_level_cp_subset). The model included id as random effects (formula:
## list(~1 | id, ~1 | trial_ratio)). The model's total explanatory power is
## substantial (conditional R2 = 0.60) and the part related to the fixed effects
## alone (marginal R2) is of 0.35. The model's intercept, corresponding to
## age_zscored = 0, magnitude = small and knower_level_cp_subset = subset, is at
## 0.78 (95% CI [0.02, 1.54], p = 0.045). Within this model:
##
## - The effect of age zscored is statistically significant and positive (beta =
## 1.18, 95% CI [0.61, 1.75], p < .001; Std. beta = 1.15, 95% CI [0.59, 1.71])
## - The effect of magnitude [large] is statistically non-significant and negative
## (beta = -0.28, 95% CI [-0.96, 0.40], p = 0.423; Std. beta = -0.28, 95% CI
## [-0.96, 0.40])
## - The effect of knower level cp subset [CP] is statistically significant and
## positive (beta = 1.31, 95% CI [0.11, 2.51], p = 0.032; Std. beta = 1.31, 95% CI
## [0.11, 2.51])
## - The effect of magnitude [large] × knower level cp subset [CP] is
## statistically non-significant and positive (beta = 0.24, 95% CI [-0.83, 1.31],
## p = 0.663; Std. beta = 0.24, 95% CI [-0.83, 1.31])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald z-distribution approximation.
Anova(fit.cp_age_int, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 4.0302 1 0.04469 *
## age_zscored 16.3978 1 5.134e-05 ***
## magnitude 0.6408 1 0.42343
## knower_level_cp_subset 4.5965 1 0.03204 *
## magnitude:knower_level_cp_subset 0.1898 1 0.66307
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(fit.cp_age_int, fit.cp_age, type = 3)
## Data: df.trial
## Models:
## fit.cp_age: correct_set_chosen ~ age_zscored + magnitude + knower_level_cp_subset + (1 | id) + (1 | trial_ratio)
## fit.cp_age_int: correct_set_chosen ~ age_zscored + magnitude * knower_level_cp_subset + (1 | id) + (1 | trial_ratio)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## fit.cp_age 6 442.68 467.85 -215.34 430.68
## fit.cp_age_int 7 444.49 473.85 -215.25 430.49 0.1898 1 0.6631
Higher overt correct set chosen for large sets compared to small sets. This makes sense because some participants are able to subitize small sets without pointing to the screen and count (and the prompt might not be clear enough for them to do this overtly).
ggplot(data = df.trial,
mapping = aes(x = knower_level_cp_subset, y = strict_correct_set_chosen)) +
geom_jitter(aes(color = id),
height = 0,
alpha = 0.5) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
facet_grid(~ magnitude) +
theme(legend.position = "none")
ggplot(data = df.trial,
mapping = aes(x = age_years, y = strict_correct_set_chosen)) +
geom_jitter(aes(color = id),
height = 0,
alpha = 0.5) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
theme(legend.position = "none")
ggplot(data = df.trial,
mapping = aes(x = age_years, y = strict_correct_set_chosen)) +
geom_jitter(aes(color = id),
height = 0,
alpha = 0.5) +
geom_bar(aes(fill = as.factor(age_years)),
stat = "summary",
fun.y = "mean") +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
facet_grid(magnitude ~ knower_level_cp_subset) +
theme(legend.position = "none")
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
Each dot is a participant. Accurracy in set chosen against age (months) looks linear.
ggplot(data = df.trial %>%
group_by(id, magnitude, knower_level_cp_subset) %>%
summarise(mean_strict_correct_set = mean(strict_correct_set_chosen, na.rm = TRUE)),
mapping = aes(x = knower_level_cp_subset, y = mean_strict_correct_set)) +
geom_violin(aes(fill = knower_level_cp_subset)) +
geom_jitter(height = 0,
alpha = 0.5) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
facet_grid(~ magnitude) +
theme(legend.position = "none")
## `summarise()` has grouped output by 'id', 'magnitude'. You can override using
## the `.groups` argument.
ggplot(data = df.trial %>%
group_by(id, magnitude, knower_level_cp_subset, age_months) %>%
summarise(mean_strict_correct_set = mean(strict_correct_set_chosen, na.rm = TRUE)),
mapping = aes(x = age_months, y = mean_strict_correct_set)) +
geom_point()+
geom_smooth(method='lm') +
theme(legend.position = "none")
## `summarise()` has grouped output by 'id', 'magnitude',
## 'knower_level_cp_subset'. You can override using the `.groups` argument.
## `geom_smooth()` using formula = 'y ~ x'
df.summary_knower_level_correct_count <- df.trial %>%
group_by(knower_level_cp_subset) %>%
summarise(mean = mean(correct_count_when_correct_set_chosen), sd = sd(correct_count_when_correct_set_chosen))
df.summary_knower_level_correct_count
## # A tibble: 2 × 3
## knower_level_cp_subset mean sd
## <fct> <dbl> <dbl>
## 1 subset 0.320 0.468
## 2 CP 0.813 0.391
df.summary_magnitude_correct_count <- df.trial %>%
group_by(knower_level_cp_subset, magnitude) %>%
summarise(mean = mean(correct_count_when_correct_set_chosen), sd = sd(correct_count_when_correct_set_chosen))
## `summarise()` has grouped output by 'knower_level_cp_subset'. You can override
## using the `.groups` argument.
df.summary_magnitude_correct_count
## # A tibble: 4 × 4
## # Groups: knower_level_cp_subset [2]
## knower_level_cp_subset magnitude mean sd
## <fct> <fct> <dbl> <dbl>
## 1 subset small 0.482 0.502
## 2 subset large 0.158 0.366
## 3 CP small 0.885 0.320
## 4 CP large 0.740 0.440
df.trial_summary_count <- df.trial %>%
group_by(id, knower_level_cp_subset) %>%
summarise(mean_correct_count_when_correct_set_chosen = mean(correct_count_when_correct_set_chosen, na.rm = TRUE)) %>%
group_by(knower_level_cp_subset) %>%
summarise(n_total = n(),
n_succeed = length(id[mean_correct_count_when_correct_set_chosen <= 3/6]),
prop_succeed =n_succeed / n_total)
## `summarise()` has grouped output by 'id'. You can override using the `.groups`
## argument.
df.trial_summary_count
## # A tibble: 2 × 4
## knower_level_cp_subset n_total n_succeed prop_succeed
## <fct> <int> <int> <dbl>
## 1 subset 38 32 0.842
## 2 CP 44 5 0.114
ggplot(data = df.trial,
mapping = aes(x = knower_level_cp_subset, y = correct_count_when_correct_set_chosen)) +
geom_jitter(aes(color = id),
height = 0,
alpha = 0.5) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
facet_grid(~ magnitude) +
theme(legend.position = "none")
ggplot(data = df.trial,
mapping = aes(x = age_years, y = correct_count_when_correct_set_chosen)) +
geom_jitter(aes(color = id),
height = 0,
alpha = 0.5) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
theme(legend.position = "none")
ggplot(data = df.trial,
mapping = aes(x = age_years, y = correct_count_when_correct_set_chosen)) +
geom_jitter(aes(color = id),
height = 0,
alpha = 0.5) +
geom_bar(aes(fill = as.factor(age_years)),
stat = "summary",
fun.y = "mean") +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
facet_grid(magnitude ~ knower_level_cp_subset) +
theme(legend.position = "none")
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
All children are better at counting small sets compared to large sets, while there is no difference in performance of selecting the correct set. So either: 1) They are doing cardinal extension, but are making errors in the counting due to the larger set, or 2) The good performance for choosing the correct set just reflects mapping of animals to a side – once the animals are gone, they just select the corresponding side without understanding the quantity relationship between the items and the animals.
plot2 <- ggplot(data = df.trial %>%
group_by(id, magnitude, knower_level_cp_subset) %>%
mutate(magnitude = factor(magnitude, levels = c("small", "large"), labels = c("small sets", "large sets")),
knower_level_cp_subset = factor(knower_level_cp_subset, levels = c("subset", "CP"))) %>%
summarise(mean_correct_count = mean(correct_count_when_correct_set_chosen, na.rm = TRUE)),
mapping = aes(x = knower_level_cp_subset, y = mean_correct_count)) +
geom_violin(aes(fill = knower_level_cp_subset)) +
geom_jitter(height = 0,
alpha = 0.5) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
facet_grid(~ magnitude) +
scale_fill_manual(values=cbPalette) +
theme(legend.position = "none") +
labs(y = "Prop. of correct numerical response",
x = "Knower Level")
## `summarise()` has grouped output by 'id', 'magnitude'. You can override using
## the `.groups` argument.
ggplot(data = df.trial %>%
group_by(id, magnitude, knower_level_cp_subset, age_months) %>%
summarise(mean_correct_count = mean(correct_count_when_correct_set_chosen, na.rm = TRUE)),
mapping = aes(x = age_months, y = mean_correct_count)) +
geom_point()+
geom_smooth(method='lm') +
theme(legend.position = "none")
## `summarise()` has grouped output by 'id', 'magnitude',
## 'knower_level_cp_subset'. You can override using the `.groups` argument.
## `geom_smooth()` using formula = 'y ~ x'
ggplot(data = df.trial %>%
mutate(magnitude = factor(magnitude, levels = c("small", "large"), labels = c("small sets", "large sets"))) %>%
group_by(id, magnitude, knower_level_cp_subset, age_years_cont) %>%
summarise(mean_correct_count = mean(correct_count_when_correct_set_chosen, na.rm = TRUE)),
mapping = aes(x = age_years_cont, y = mean_correct_count,
color = knower_level_cp_subset)) +
geom_jitter(height = 0,
alpha = 0.5) +
facet_grid(~magnitude) +
ylim(0, 1) +
geom_smooth(method='lm', aes(fill = knower_level_cp_subset)) +
scale_fill_manual(values=cbPalette) +
scale_color_manual(values=cbPalette) +
labs(x = "Age (years)",
y = "Prop. correct numerical response",
fill = "Knower Level",
color = "Knower Level") +
geom_hline(yintercept = 0.5, linetype = "dashed") +
theme(text = element_text(size=12),
legend.position="none")
## `summarise()` has grouped output by 'id', 'magnitude',
## 'knower_level_cp_subset'. You can override using the `.groups` argument.
## `geom_smooth()` using formula = 'y ~ x'
combined_plot <- plot_grid(plot1, plot2, labels = c('A', 'B'))
legend <- get_legend(plot1 +
theme(legend.position = "bottom") )
plot_grid(combined_plot, ncol=1,rel_heights = c(1, .1))
report(t.test(df.trial %>%
filter(knower_level_cp_subset == "CP") %>%
pull(correct_count_when_correct_set_chosen),
df.trial %>%
filter(knower_level_cp_subset == "subset") %>%
pull(correct_count_when_correct_set_chosen)))
## Effect sizes were labelled following Cohen's (1988) recommendations.
##
## The Welch Two Sample t-test testing the difference between df.trial %>%
## filter(knower_level_cp_subset == "CP") %>%
## pull(correct_count_when_correct_set_chosen) and df.trial %>%
## filter(knower_level_cp_subset == "subset") %>%
## pull(correct_count_when_correct_set_chosen) (mean of x = 0.81, mean of y =
## 0.32) suggests that the effect is positive, statistically significant, and
## large (difference = 0.49, 95% CI [0.42, 0.57], t(444.06) = 12.55, p < .001;
## Cohen's d = 1.14, 95% CI [0.95, 1.34])
report(t.test(df.trial %>%
filter(knower_level_cp_subset == "CP", magnitude == "small") %>%
pull(correct_count_when_correct_set_chosen),
df.trial %>%
filter(knower_level_cp_subset == "subset", magnitude == "small") %>%
pull(correct_count_when_correct_set_chosen)))
## Effect sizes were labelled following Cohen's (1988) recommendations.
##
## The Welch Two Sample t-test testing the difference between df.trial %>%
## filter(knower_level_cp_subset == "CP", magnitude == "small") %>%
## pull(correct_count_when_correct_set_chosen) and df.trial %>%
## filter(knower_level_cp_subset == "subset", magnitude == "small") %>%
## pull(correct_count_when_correct_set_chosen) (mean of x = 0.89, mean of y =
## 0.48) suggests that the effect is positive, statistically significant, and
## large (difference = 0.40, 95% CI [0.30, 0.51], t(186.64) = 7.37, p < .001;
## Cohen's d = 0.96, 95% CI [0.68, 1.23])
report(t.test(df.trial %>%
filter(knower_level_cp_subset == "CP", magnitude == "large") %>%
pull(correct_count_when_correct_set_chosen),
df.trial %>%
filter(knower_level_cp_subset == "subset", magnitude == "large") %>%
pull(correct_count_when_correct_set_chosen)))
## Effect sizes were labelled following Cohen's (1988) recommendations.
##
## The Welch Two Sample t-test testing the difference between df.trial %>%
## filter(knower_level_cp_subset == "CP", magnitude == "large") %>%
## pull(correct_count_when_correct_set_chosen) and df.trial %>%
## filter(knower_level_cp_subset == "subset", magnitude == "large") %>%
## pull(correct_count_when_correct_set_chosen) (mean of x = 0.74, mean of y =
## 0.16) suggests that the effect is positive, statistically significant, and
## large (difference = 0.58, 95% CI [0.48, 0.68], t(242.54) = 11.31, p < .001;
## Cohen's d = 1.44, 95% CI [1.16, 1.72])
correct_count_when_correct_set_chosen ~ magnitude + age_zscored + (1|id) + (1|trial_ratio) Effect of age
#registered
#only age has an effect
#z-scored age based on previous work
fit.base <- glmer(correct_count_when_correct_set_chosen ~ magnitude + age_zscored + (1|id) + (1|trial_ratio), data = df.trial, family="binomial")
summary(fit.base)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: correct_count_when_correct_set_chosen ~ magnitude + age_zscored +
## (1 | id) + (1 | trial_ratio)
## Data: df.trial
##
## AIC BIC logLik deviance df.resid
## 460.8 481.8 -225.4 450.8 485
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.2587 -0.4037 0.1410 0.3858 2.6273
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 3.2700 1.8083
## trial_ratio (Intercept) 0.1126 0.3355
## Number of obs: 490, groups: id, 82; trial_ratio, 6
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.5536 0.3680 4.222 2.42e-05 ***
## magnitudelarge -1.9204 0.4132 -4.648 3.36e-06 ***
## age_zscored 1.8943 0.3043 6.226 4.80e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) mgntdl
## magnitudlrg -0.621
## age_zscored 0.187 -0.231
report(fit.base)
## We fitted a logistic mixed model (estimated using ML and Nelder-Mead optimizer)
## to predict correct_count_when_correct_set_chosen with magnitude and age_zscored
## (formula: correct_count_when_correct_set_chosen ~ magnitude + age_zscored). The
## model included id as random effects (formula: list(~1 | id, ~1 | trial_ratio)).
## The model's total explanatory power is substantial (conditional R2 = 0.70) and
## the part related to the fixed effects alone (marginal R2) is of 0.40. The
## model's intercept, corresponding to magnitude = small and age_zscored = 0, is
## at 1.55 (95% CI [0.83, 2.27], p < .001). Within this model:
##
## - The effect of magnitude [large] is statistically significant and negative
## (beta = -1.92, 95% CI [-2.73, -1.11], p < .001; Std. beta = -1.92, 95% CI
## [-2.73, -1.11])
## - The effect of age zscored is statistically significant and positive (beta =
## 1.89, 95% CI [1.30, 2.49], p < .001; Std. beta = 1.85, 95% CI [1.27, 2.43])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald z-distribution approximation.
Anova(fit.base, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_count_when_correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 17.825 1 2.422e-05 ***
## magnitude 21.601 1 3.357e-06 ***
## age_zscored 38.758 1 4.796e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
correct_count_when_correct_set_chosen ~ CP knowledge + magnitude + age_zscored + (1|id) + (1|trial_ratio) Effect of age
#registered
#z-scored age based on previous work
fit.cp_age <- glmer(correct_count_when_correct_set_chosen ~ knower_level_cp_subset + magnitude + age_zscored + (1|id) + (1|trial_ratio), data = df.trial, family="binomial")
summary(fit.cp_age)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: correct_count_when_correct_set_chosen ~ knower_level_cp_subset +
## magnitude + age_zscored + (1 | id) + (1 | trial_ratio)
## Data: df.trial
##
## AIC BIC logLik deviance df.resid
## 447.2 472.4 -217.6 435.2 484
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.8164 -0.3807 0.1424 0.3866 2.9065
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 2.2066 1.4855
## trial_ratio (Intercept) 0.1152 0.3394
## Number of obs: 490, groups: id, 82; trial_ratio, 6
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.3836 0.4189 0.916 0.359811
## knower_level_cp_subsetCP 2.2162 0.5555 3.990 6.61e-05 ***
## magnitudelarge -1.9261 0.4163 -4.627 3.71e-06 ***
## age_zscored 1.0882 0.2963 3.672 0.000241 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) k___CP mgntdl
## knwr_lv__CP -0.570
## magnitudlrg -0.440 -0.155
## age_zscored 0.397 -0.449 -0.135
report(fit.cp_age)
## We fitted a logistic mixed model (estimated using ML and Nelder-Mead optimizer)
## to predict correct_count_when_correct_set_chosen with knower_level_cp_subset,
## magnitude and age_zscored (formula: correct_count_when_correct_set_chosen ~
## knower_level_cp_subset + magnitude + age_zscored). The model included id as
## random effects (formula: list(~1 | id, ~1 | trial_ratio)). The model's total
## explanatory power is substantial (conditional R2 = 0.68) and the part related
## to the fixed effects alone (marginal R2) is of 0.46. The model's intercept,
## corresponding to knower_level_cp_subset = subset, magnitude = small and
## age_zscored = 0, is at 0.38 (95% CI [-0.44, 1.20], p = 0.360). Within this
## model:
##
## - The effect of knower level cp subset [CP] is statistically significant and
## positive (beta = 2.22, 95% CI [1.13, 3.30], p < .001; Std. beta = 2.22, 95% CI
## [1.13, 3.30])
## - The effect of magnitude [large] is statistically significant and negative
## (beta = -1.93, 95% CI [-2.74, -1.11], p < .001; Std. beta = -1.93, 95% CI
## [-2.74, -1.11])
## - The effect of age zscored is statistically significant and positive (beta =
## 1.09, 95% CI [0.51, 1.67], p < .001; Std. beta = 1.06, 95% CI [0.50, 1.63])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald z-distribution approximation.
Anova(fit.cp_age, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_count_when_correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 0.8386 1 0.3598107
## knower_level_cp_subset 15.9183 1 6.614e-05 ***
## magnitude 21.4079 1 3.712e-06 ***
## age_zscored 13.4848 1 0.0002405 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(fit.cp_age, fit.base, type = 3)
## Data: df.trial
## Models:
## fit.base: correct_count_when_correct_set_chosen ~ magnitude + age_zscored + (1 | id) + (1 | trial_ratio)
## fit.cp_age: correct_count_when_correct_set_chosen ~ knower_level_cp_subset + magnitude + age_zscored + (1 | id) + (1 | trial_ratio)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## fit.base 5 460.80 481.77 -225.40 450.80
## fit.cp_age 6 447.23 472.39 -217.61 435.23 15.577 1 7.922e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
correct_count_when_correct_set_chosen ~ CP knowledge * magnitude + age_zscored + (1|id) + (1|trial_ratio) Effect of age
#registered
#z-scored age based on previous work
fit.cp_age_int <- glmer(correct_count_when_correct_set_chosen ~ knower_level_cp_subset * magnitude + age_zscored + (1|id) + (1|trial_ratio), data = df.trial, family="binomial")
summary(fit.cp_age_int)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: correct_count_when_correct_set_chosen ~ knower_level_cp_subset *
## magnitude + age_zscored + (1 | id) + (1 | trial_ratio)
## Data: df.trial
##
## AIC BIC logLik deviance df.resid
## 444.5 473.8 -215.2 430.5 483
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.8301 -0.3478 0.1699 0.4007 3.6942
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 2.3893 1.546
## trial_ratio (Intercept) 0.1184 0.344
## Number of obs: 490, groups: id, 82; trial_ratio, 6
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.6424 0.4480 1.434 0.151649
## knower_level_cp_subsetCP 1.5273 0.6399 2.387 0.017000
## magnitudelarge -2.5913 0.5446 -4.758 1.95e-06
## age_zscored 1.1527 0.3088 3.733 0.000189
## knower_level_cp_subsetCP:magnitudelarge 1.2809 0.5967 2.147 0.031813
##
## (Intercept)
## knower_level_cp_subsetCP *
## magnitudelarge ***
## age_zscored ***
## knower_level_cp_subsetCP:magnitudelarge *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) kn___CP mgntdl ag_zsc
## knwr_lv__CP -0.639
## magnitudlrg -0.494 0.198
## age_zscored 0.420 -0.464 -0.200
## knwr_l__CP: 0.288 -0.458 -0.634 0.141
report(fit.cp_age_int)
## We fitted a logistic mixed model (estimated using ML and Nelder-Mead optimizer)
## to predict correct_count_when_correct_set_chosen with knower_level_cp_subset,
## magnitude and age_zscored (formula: correct_count_when_correct_set_chosen ~
## knower_level_cp_subset * magnitude + age_zscored). The model included id as
## random effects (formula: list(~1 | id, ~1 | trial_ratio)). The model's total
## explanatory power is substantial (conditional R2 = 0.69) and the part related
## to the fixed effects alone (marginal R2) is of 0.46. The model's intercept,
## corresponding to knower_level_cp_subset = subset, magnitude = small and
## age_zscored = 0, is at 0.64 (95% CI [-0.24, 1.52], p = 0.152). Within this
## model:
##
## - The effect of knower level cp subset [CP] is statistically significant and
## positive (beta = 1.53, 95% CI [0.27, 2.78], p = 0.017; Std. beta = 1.53, 95% CI
## [0.27, 2.78])
## - The effect of magnitude [large] is statistically significant and negative
## (beta = -2.59, 95% CI [-3.66, -1.52], p < .001; Std. beta = -2.59, 95% CI
## [-3.66, -1.52])
## - The effect of age zscored is statistically significant and positive (beta =
## 1.15, 95% CI [0.55, 1.76], p < .001; Std. beta = 1.13, 95% CI [0.54, 1.72])
## - The effect of knower level cp subset [CP] × magnitude [large] is
## statistically significant and positive (beta = 1.28, 95% CI [0.11, 2.45], p =
## 0.032; Std. beta = 1.28, 95% CI [0.11, 2.45])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald z-distribution approximation.
Anova(fit.cp_age_int, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_count_when_correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 2.0556 1 0.1516490
## knower_level_cp_subset 5.6963 1 0.0170004 *
## magnitude 22.6394 1 1.954e-06 ***
## age_zscored 13.9350 1 0.0001892 ***
## knower_level_cp_subset:magnitude 4.6085 1 0.0318131 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(fit.cp_age_int, fit.cp_age, type = 3)
## Data: df.trial
## Models:
## fit.cp_age: correct_count_when_correct_set_chosen ~ knower_level_cp_subset + magnitude + age_zscored + (1 | id) + (1 | trial_ratio)
## fit.cp_age_int: correct_count_when_correct_set_chosen ~ knower_level_cp_subset * magnitude + age_zscored + (1 | id) + (1 | trial_ratio)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## fit.cp_age 6 447.23 472.39 -217.61 435.23
## fit.cp_age_int 7 444.46 473.82 -215.23 430.46 4.7654 1 0.02904 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(fit.cp_age_int, fit.base, type = 3)
## Data: df.trial
## Models:
## fit.base: correct_count_when_correct_set_chosen ~ magnitude + age_zscored + (1 | id) + (1 | trial_ratio)
## fit.cp_age_int: correct_count_when_correct_set_chosen ~ knower_level_cp_subset * magnitude + age_zscored + (1 | id) + (1 | trial_ratio)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## fit.base 5 460.80 481.77 -225.40 450.80
## fit.cp_age_int 7 444.46 473.82 -215.23 430.46 20.342 2 3.826e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
fit.cp_age_int %>%
emmeans(specs = pairwise ~ knower_level_cp_subset * magnitude,
adjust = "bonferroni") %>%
pluck("contrasts")
## contrast estimate SE df z.ratio p.value
## subset small - CP small -1.527 0.640 Inf -2.387 0.1020
## subset small - subset large 2.591 0.545 Inf 4.758 <.0001
## subset small - CP large -0.217 0.662 Inf -0.328 1.0000
## CP small - subset large 4.119 0.754 Inf 5.465 <.0001
## CP small - CP large 1.310 0.491 Inf 2.671 0.0453
## subset large - CP large -2.808 0.645 Inf -4.357 0.0001
##
## Results are given on the log odds ratio (not the response) scale.
## P value adjustment: bonferroni method for 6 tests
ggplot(data = df.trial %>%
filter(correct_count == 0 & correct_set_chosen == 1))
df.trial %>%
filter(correct_count == 0 & correct_set_chosen == 1) %>%
group_by(knower_level_cp_subset, magnitude) %>%
summarise(count = n())
## `summarise()` has grouped output by 'knower_level_cp_subset'. You can override
## using the `.groups` argument.
## # A tibble: 3 × 3
## # Groups: knower_level_cp_subset [2]
## knower_level_cp_subset magnitude count
## <fct> <fct> <int>
## 1 subset small 3
## 2 subset large 35
## 3 CP large 18
When allowed for off by 1 error, the subset knowers are better but still worse than the CP knowers. This is not very informative anyway.
ggplot(data = df.trial %>% filter(magnitude == "large"),
mapping = aes(x = knower_level_cp_subset, y = correct_count_approx)) +
geom_jitter(aes(color = id),
height = 0,
alpha = 0.5) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
facet_grid(~ magnitude) +
theme(legend.position = "none")
ggplot(data = df.trial %>% filter(magnitude == "large"),
mapping = aes(x = age_years, y = correct_count_approx)) +
geom_jitter(aes(color = id),
height = 0,
alpha = 0.5) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
theme(legend.position = "none")
ggplot(data = df.trial %>%
filter(magnitude == "large") %>%
group_by(id, knower_level_cp_subset, age_years) %>%
summarise(mean_correct_count = mean(correct_count, na.rm = TRUE),
mean_correct_count_approx = mean(correct_count_approx), na.rm = TRUE) %>%
select(id, knower_level_cp_subset, age_years, mean_correct_count, mean_correct_count_approx) %>%
pivot_longer(c(mean_correct_count, mean_correct_count_approx), names_to = "key", values_to = "mean_accuracy"),
mapping = aes(x = age_years, y = mean_accuracy, fill = key)) +
geom_jitter(aes(color = id),
height = 0,
alpha = 0.5) +
geom_bar(stat = "summary",
fun.y = "mean",
position = "dodge") +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange",
position = position_dodge(0.9)) +
facet_grid(~ knower_level_cp_subset) +
guides(color = "none")
## `summarise()` has grouped output by 'id', 'knower_level_cp_subset'. You can
## override using the `.groups` argument.
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
ggplot(data = df.trial %>%
select(magnitude, knower_level_cp_subset, correct_set_chosen, correct_count_when_correct_set_chosen) %>%
pivot_longer(-c(magnitude, knower_level_cp_subset), names_to = "variable", values_to = "value"),
mapping = aes(x = knower_level_cp_subset, y = value, color = variable)) +
facet_grid(~magnitude) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange",
position = position_dodge(0.7)) +
labs(y = "Cardinal extension success (by trial)",
x = "Trial Type")
Absolute value of error decreases by age, and increases (slightly) as the target set correct count is bigger.
ggplot(data = df.trial,
mapping = aes(x = knower_level_cp_subset, y = abs(count_error))) +
geom_jitter(aes(color = id),
height = 0,
alpha = 0.5) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
facet_grid(~ magnitude) +
ylim(NA, 10) +
theme(legend.position = "none")
ggplot(data = df.trial,
mapping = aes(x = age_years, y = abs(count_error))) +
geom_jitter(aes(color = id),
height = 0,
alpha = 0.5) +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
ylim(NA, 10) +
theme(legend.position = "none")
ggplot(data = df.trial,
mapping = aes(x = age_years, y = abs(count_error))) +
geom_jitter(aes(color = id),
height = 0,
alpha = 0.5) +
geom_bar(aes(fill = as.factor(age_years)),
stat = "summary",
fun.y = "mean") +
stat_summary(fun.data = "mean_cl_boot",
geom = "pointrange") +
facet_grid(magnitude ~ knower_level_cp_subset) +
ylim(NA, 10) +
theme(legend.position = "none")
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
## No summary function supplied, defaulting to `mean_se()`
ggplot(data = df.trial,
mapping = aes(x = target_count, y = abs(count_error))) +
geom_point()+
geom_smooth(method='lm') +
facet_grid(~ knower_level_cp_subset) +
ylim(NA, 10) +
theme(legend.position = "none")
## `geom_smooth()` using formula = 'y ~ x'
Highest count does not explain additional variance.
fit.set_hc <- glmer(correct_set_chosen ~ age_zscored + magnitude + knower_level_cp_subset + highest_count + (1|id)
+ (1|trial_ratio)
,
data = df.trial %>%
filter(!is.na(highest_count)),
family="binomial")
summary(fit.set_hc)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## correct_set_chosen ~ age_zscored + magnitude + knower_level_cp_subset +
## highest_count + (1 | id) + (1 | trial_ratio)
## Data: df.trial %>% filter(!is.na(highest_count))
##
## AIC BIC logLik deviance df.resid
## 418.6 447.6 -202.3 404.6 459
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6832 -0.3263 0.2092 0.4123 2.2450
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 1.76359 1.3280
## trial_ratio (Intercept) 0.04748 0.2179
## Number of obs: 466, groups: id, 78; trial_ratio, 6
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.897006 0.405173 2.214 0.0268 *
## age_zscored 1.247404 0.304480 4.097 4.19e-05 ***
## magnitudelarge -0.166561 0.325087 -0.512 0.6084
## knower_level_cp_subsetCP 1.106148 0.561798 1.969 0.0490 *
## highest_count 0.003451 0.014013 0.246 0.8055
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) ag_zsc mgntdl k___CP
## age_zscored 0.451
## magnitudlrg -0.409 -0.014
## knwr_lv__CP -0.477 -0.438 -0.014
## highest_cnt -0.284 -0.083 0.004 -0.334
Anova(fit.set_hc, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 4.9013 1 0.02684 *
## age_zscored 16.7841 1 4.188e-05 ***
## magnitude 0.2625 1 0.60840
## knower_level_cp_subset 3.8767 1 0.04896 *
## highest_count 0.0606 1 0.80548
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
fit.set_hc_comp <- glmer(correct_set_chosen ~ magnitude + age_zscored + knower_level_cp_subset + (1|id)
+ (1|trial_ratio)
,
data = df.trial %>%
filter(!is.na(highest_count)),
family="binomial")
summary(fit.set_hc_comp)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## correct_set_chosen ~ magnitude + age_zscored + knower_level_cp_subset +
## (1 | id) + (1 | trial_ratio)
## Data: df.trial %>% filter(!is.na(highest_count))
##
## AIC BIC logLik deviance df.resid
## 416.6 441.5 -202.3 404.6 460
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.4073 -0.3260 0.2059 0.4087 2.2478
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 1.77788 1.3334
## trial_ratio (Intercept) 0.04767 0.2183
## Number of obs: 466, groups: id, 78; trial_ratio, 6
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.9257 0.3894 2.377 0.0174 *
## magnitudelarge -0.1669 0.3254 -0.513 0.6079
## age_zscored 1.2543 0.3040 4.126 3.69e-05 ***
## knower_level_cp_subsetCP 1.1535 0.5305 2.174 0.0297 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) mgntdl ag_zsc
## magnitudlrg -0.425
## age_zscored 0.447 -0.013
## knwr_lv__CP -0.633 -0.014 -0.495
Anova(fit.set_hc_comp, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 5.6522 1 0.01743 *
## magnitude 0.2632 1 0.60795
## age_zscored 17.0266 1 3.686e-05 ***
## knower_level_cp_subset 4.7281 1 0.02967 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(fit.set_hc, fit.set_hc_comp)
## Data: df.trial %>% filter(!is.na(highest_count))
## Models:
## fit.set_hc_comp: correct_set_chosen ~ magnitude + age_zscored + knower_level_cp_subset + (1 | id) + (1 | trial_ratio)
## fit.set_hc: correct_set_chosen ~ age_zscored + magnitude + knower_level_cp_subset + highest_count + (1 | id) + (1 | trial_ratio)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## fit.set_hc_comp 6 416.65 441.51 -202.32 404.65
## fit.set_hc 7 418.59 447.59 -202.29 404.59 0.0612 1 0.8046
# knower level effect is wiped out by age effects
fit.set_hc_cp_only <- glmer(correct_set_chosen ~ highest_count + magnitude + age_zscored + (1|id)
#+ (1|trial_ratio)
, data = df.trial %>%
filter(knower_level_cp_subset == "CP") %>%
filter(!is.na(highest_count)),
family="binomial")
summary(fit.set_hc_cp_only)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: correct_set_chosen ~ highest_count + magnitude + age_zscored +
## (1 | id)
## Data:
## df.trial %>% filter(knower_level_cp_subset == "CP") %>% filter(!is.na(highest_count))
##
## AIC BIC logLik deviance df.resid
## 182.5 200.3 -86.2 172.5 257
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.1644 0.1702 0.1890 0.3523 0.8899
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 2.486 1.577
## Number of obs: 262, groups: id, 44
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.420524 0.631882 3.831 0.000128 ***
## highest_count 0.003387 0.015950 0.212 0.831825
## magnitudelarge -0.045373 0.433989 -0.105 0.916735
## age_zscored 0.577977 0.478507 1.208 0.227095
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) hghst_ mgntdl
## highest_cnt -0.515
## magnitudlrg -0.355 0.004
## age_zscored -0.214 -0.140 0.013
Anova(fit.set_hc_cp_only, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 14.6739 1 0.0001278 ***
## highest_count 0.0451 1 0.8318252
## magnitude 0.0109 1 0.9167347
## age_zscored 1.4590 1 0.2270948
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
fit.set_hc_cp_only_comp <- glmer(correct_set_chosen ~ magnitude + age_zscored + (1|id)
#+ (1|trial_ratio)
, data = df.trial %>%
filter(knower_level_cp_subset == "CP") %>%
filter(!is.na(highest_count)),
family="binomial")
summary(fit.set_hc_cp_only_comp)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: correct_set_chosen ~ magnitude + age_zscored + (1 | id)
## Data:
## df.trial %>% filter(knower_level_cp_subset == "CP") %>% filter(!is.na(highest_count))
##
## AIC BIC logLik deviance df.resid
## 180.5 194.8 -86.3 172.5 258
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9933 0.1687 0.1857 0.3535 0.8864
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 2.505 1.583
## Number of obs: 262, groups: id, 44
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.49249 0.54164 4.602 4.19e-06 ***
## magnitudelarge -0.04575 0.43409 -0.105 0.916
## age_zscored 0.59299 0.47412 1.251 0.211
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) mgntdl
## magnitudlrg -0.412
## age_zscored -0.334 0.013
Anova(fit.set_hc_cp_only_comp, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 21.1764 1 4.189e-06 ***
## magnitude 0.0111 1 0.9161
## age_zscored 1.5643 1 0.2110
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(fit.set_hc_cp_only, fit.set_hc_cp_only_comp, type = 3)
## Data: df.trial %>% filter(knower_level_cp_subset == "CP") %>% filter(!is.na(highest_count))
## Models:
## fit.set_hc_cp_only_comp: correct_set_chosen ~ magnitude + age_zscored + (1 | id)
## fit.set_hc_cp_only: correct_set_chosen ~ highest_count + magnitude + age_zscored + (1 | id)
## npar AIC BIC logLik deviance Chisq Df
## fit.set_hc_cp_only_comp 4 180.54 194.81 -86.269 172.54
## fit.set_hc_cp_only 5 182.49 200.34 -86.246 172.49 0.0453 1
## Pr(>Chisq)
## fit.set_hc_cp_only_comp
## fit.set_hc_cp_only 0.8314
fit.count_hc <- glmer(correct_count_when_correct_set_chosen ~ age_zscored + knower_level_cp_subset * magnitude + highest_count + (1|id) + (1|trial_ratio),
data = df.trial %>%
filter(!is.na(highest_count)),
family="binomial")
summary(fit.count_hc)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## correct_count_when_correct_set_chosen ~ age_zscored + knower_level_cp_subset *
## magnitude + highest_count + (1 | id) + (1 | trial_ratio)
## Data: df.trial %>% filter(!is.na(highest_count))
##
## AIC BIC logLik deviance df.resid
## 427.7 460.9 -205.9 411.7 458
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.2515 -0.3369 0.1841 0.4019 3.7380
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 2.3355 1.5282
## trial_ratio (Intercept) 0.1688 0.4109
## Number of obs: 466, groups: id, 78; trial_ratio, 6
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.759605 0.493519 1.539 0.123765
## age_zscored 1.212124 0.331102 3.661 0.000251
## knower_level_cp_subsetCP 1.222113 0.669970 1.824 0.068132
## magnitudelarge -2.624077 0.586045 -4.478 7.55e-06
## highest_count 0.007894 0.014503 0.544 0.586222
## knower_level_cp_subsetCP:magnitudelarge 1.295694 0.607666 2.132 0.032987
##
## (Intercept)
## age_zscored ***
## knower_level_cp_subsetCP .
## magnitudelarge ***
## highest_count
## knower_level_cp_subsetCP:magnitudelarge *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) ag_zsc kn___CP mgntdl hghst_
## age_zscored 0.393
## knwr_lv__CP -0.519 -0.413
## magnitudlrg -0.513 -0.196 0.201
## highest_cnt -0.246 -0.097 -0.258 0.005
## knwr_l__CP: 0.291 0.143 -0.454 -0.612 -0.012
Anova(fit.count_hc, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_count_when_correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 2.3690 1 0.1237650
## age_zscored 13.4020 1 0.0002514 ***
## knower_level_cp_subset 3.3275 1 0.0681322 .
## magnitude 20.0489 1 7.549e-06 ***
## highest_count 0.2963 1 0.5862224
## knower_level_cp_subset:magnitude 4.5465 1 0.0329866 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
fit.count_hc_comp <- glmer(correct_count_when_correct_set_chosen ~ age_zscored + knower_level_cp_subset * magnitude + (1|id) + (1|trial_ratio),
data = df.trial %>%
filter(!is.na(highest_count)),
family="binomial")
summary(fit.count_hc_comp)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## correct_count_when_correct_set_chosen ~ age_zscored + knower_level_cp_subset *
## magnitude + (1 | id) + (1 | trial_ratio)
## Data: df.trial %>% filter(!is.na(highest_count))
##
## AIC BIC logLik deviance df.resid
## 426.0 455.1 -206.0 412.0 459
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.0628 -0.3379 0.1810 0.4098 3.7480
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 2.3717 1.5400
## trial_ratio (Intercept) 0.1696 0.4119
## Number of obs: 466, groups: id, 78; trial_ratio, 6
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.8280 0.4803 1.724 0.084720
## age_zscored 1.2335 0.3309 3.727 0.000194
## knower_level_cp_subsetCP 1.3205 0.6495 2.033 0.042053
## magnitudelarge -2.6323 0.5872 -4.483 7.36e-06
## knower_level_cp_subsetCP:magnitudelarge 1.3036 0.6083 2.143 0.032092
##
## (Intercept) .
## age_zscored ***
## knower_level_cp_subsetCP *
## magnitudelarge ***
## knower_level_cp_subsetCP:magnitudelarge *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) ag_zsc kn___CP mgntdl
## age_zscored 0.382
## knwr_lv__CP -0.623 -0.454
## magnitudlrg -0.527 -0.198 0.210
## knwr_l__CP: 0.297 0.143 -0.472 -0.612
Anova(fit.count_hc_comp, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_count_when_correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 2.9719 1 0.0847198 .
## age_zscored 13.8930 1 0.0001935 ***
## knower_level_cp_subset 4.1331 1 0.0420528 *
## magnitude 20.0973 1 7.36e-06 ***
## knower_level_cp_subset:magnitude 4.5936 1 0.0320919 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(fit.count_hc, fit.count_hc_comp, type = 3)
## Data: df.trial %>% filter(!is.na(highest_count))
## Models:
## fit.count_hc_comp: correct_count_when_correct_set_chosen ~ age_zscored + knower_level_cp_subset * magnitude + (1 | id) + (1 | trial_ratio)
## fit.count_hc: correct_count_when_correct_set_chosen ~ age_zscored + knower_level_cp_subset * magnitude + highest_count + (1 | id) + (1 | trial_ratio)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## fit.count_hc_comp 7 426.04 455.05 -206.02 412.04
## fit.count_hc 8 427.74 460.89 -205.87 411.74 0.3006 1 0.5835
fit.count_hc_cp_only <- glmer(correct_count_when_correct_set_chosen ~ age_zscored + magnitude + highest_count + (1|id) + (1|trial_ratio),
data = df.trial %>%
filter(!is.na(highest_count)) %>%
filter(knower_level_cp_subset == "CP"),
family="binomial")
summary(fit.count_hc_cp_only)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: correct_count_when_correct_set_chosen ~ age_zscored + magnitude +
## highest_count + (1 | id) + (1 | trial_ratio)
## Data:
## df.trial %>% filter(!is.na(highest_count)) %>% filter(knower_level_cp_subset ==
## "CP")
##
## AIC BIC logLik deviance df.resid
## 237.5 258.9 -112.7 225.5 256
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.8547 0.1618 0.2995 0.3995 1.0488
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 1.7412 1.3196
## trial_ratio (Intercept) 0.1296 0.3601
## Number of obs: 262, groups: id, 44; trial_ratio, 6
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.23335 0.57777 3.865 0.000111 ***
## age_zscored 0.37958 0.39159 0.969 0.332379
## magnitudelarge -1.26118 0.49776 -2.534 0.011286 *
## highest_count 0.01019 0.01373 0.742 0.458163
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) ag_zsc mgntdl
## age_zscored -0.247
## magnitudlrg -0.555 -0.029
## highest_cnt -0.430 -0.143 -0.019
Anova(fit.count_hc_cp_only, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_count_when_correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 14.9417 1 0.0001109 ***
## age_zscored 0.9396 1 0.3323785
## magnitude 6.4198 1 0.0112857 *
## highest_count 0.5504 1 0.4581631
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
fit.count_hc_cp_only_comp <- glmer(correct_count_when_correct_set_chosen ~ age_zscored + magnitude + (1|id) + (1|trial_ratio),
data = df.trial %>%
filter(!is.na(highest_count))%>%
filter(knower_level_cp_subset == "CP"),
family="binomial")
summary(fit.count_hc_cp_only_comp)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: correct_count_when_correct_set_chosen ~ age_zscored + magnitude +
## (1 | id) + (1 | trial_ratio)
## Data:
## df.trial %>% filter(!is.na(highest_count)) %>% filter(knower_level_cp_subset ==
## "CP")
##
## AIC BIC logLik deviance df.resid
## 236.0 253.9 -113.0 226.0 257
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.9092 0.1610 0.2974 0.3971 1.0722
##
## Random effects:
## Groups Name Variance Std.Dev.
## id (Intercept) 1.797 1.3405
## trial_ratio (Intercept) 0.130 0.3605
## Number of obs: 262, groups: id, 44; trial_ratio, 6
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.4410 0.5231 4.666 3.07e-06 ***
## age_zscored 0.4245 0.3881 1.094 0.2741
## magnitudelarge -1.2633 0.4982 -2.536 0.0112 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) ag_zsc
## age_zscored -0.339
## magnitudlrg -0.624 -0.034
Anova(fit.count_hc_cp_only_comp, type = 3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
##
## Response: correct_count_when_correct_set_chosen
## Chisq Df Pr(>Chisq)
## (Intercept) 21.7726 1 3.07e-06 ***
## age_zscored 1.1961 1 0.27411
## magnitude 6.4295 1 0.01122 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(fit.count_hc_cp_only, fit.count_hc_cp_only_comp, type = 3)
## Data: df.trial %>% filter(!is.na(highest_count)) %>% filter(knower_level_cp_subset == ...
## Models:
## fit.count_hc_cp_only_comp: correct_count_when_correct_set_chosen ~ age_zscored + magnitude + (1 | id) + (1 | trial_ratio)
## fit.count_hc_cp_only: correct_count_when_correct_set_chosen ~ age_zscored + magnitude + highest_count + (1 | id) + (1 | trial_ratio)
## npar AIC BIC logLik deviance Chisq Df
## fit.count_hc_cp_only_comp 5 236.03 253.87 -113.01 226.03
## fit.count_hc_cp_only 6 237.46 258.87 -112.73 225.46 0.5688 1
## Pr(>Chisq)
## fit.count_hc_cp_only_comp
## fit.count_hc_cp_only 0.4508