Children Data

Number of participants

df.response <- read.csv("../../data/PROCESSED_DATA/response.csv")
df.response %>%
  summarise(n_participants = n_distinct(PID))
##   n_participants
## 1             48
df.demog_age <- df.response %>%
  group_by(PID) %>%
  slice(1) %>%
  ungroup()

df.demog_age_summary <- df.demog_age %>%
  summarise(mean_age = mean(age_years_cont, na.rm = T), 
            sd_age = sd(age_years_cont, na.rm = T), 
            min_age = min(age_years_cont, na.rm = T), 
            max_age = max(age_years_cont, na.rm = T))

df.demog_age_summary
## # A tibble: 1 × 4
##   mean_age sd_age min_age max_age
##      <dbl>  <dbl>   <dbl>   <dbl>
## 1     4.99  0.506    4.02    5.99
df.demog_gender <- df.response %>%
  group_by(PID) %>%
  slice(1) %>%
  ungroup() 

df.demog_gender_summary <- df.demog_gender %>%
  group_by(Gender) %>%
  count()

df.demog_gender_summary
## # A tibble: 2 × 2
## # Groups:   Gender [2]
##   Gender     n
##   <chr>  <int>
## 1 Female    32
## 2 Male      16

Plots

Give-Letter Task

ggplot(df.response %>%
         filter(Task == "Letter_Training") %>%
         group_by(PID, LT.Letter_Requested), 
       aes(x = LT.Letter_Requested, y = LT.Correct, fill = LT.Phase)) + 
  stat_summary(fun.data = "mean_cl_boot", 
               geom = "bar") +
  stat_summary(fun.data = "mean_cl_boot", 
               geom = "pointrange") +
  ylim(0, 1) +
  labs(y = "Proportion Correct", 
       x = "Letter Requested")  + 
  theme(text=element_text(size=15)) + 
  scale_fill_manual(values = cbPalette)

Later-Greater Tasks

ggplot(df.response %>%
         filter(Task %in% c("Number_LG", "Letter_LG")) %>%
         mutate(LG.Is_Correct = coalesce(LLG.Is_Correct, NLG.Is_Correct)) %>%
         group_by(PID, Task) %>%
         summarize(LG.Mean_Correct = mean(LG.Is_Correct, na.rm = T)), 
       aes(x = Task, y = LG.Mean_Correct)) + 
  stat_summary(fun.data = "mean_cl_boot", 
               geom = "pointrange") +
  geom_dotplot(binaxis = "y", stackdir = "center", 
               alpha = 0.5, 
               dotsize = 0.5, 
               aes(group = Task, 
                   fill = Task)) +
  geom_hline(yintercept = 0.5, linetype = "dashed")
## `summarise()` has regrouped the output.
## Bin width defaults to 1/30 of the range of the data. Pick better value with
## `binwidth`.
## ℹ Summaries were computed grouped by PID and Task.
## ℹ Output is grouped by PID.
## ℹ Use `summarise(.groups = "drop_last")` to silence this message.
## ℹ Use `summarise(.by = c(PID, Task))` for per-operation grouping
##   (`?dplyr::dplyr_by`) instead.

ggplot(df.response %>%
         filter(Task %in% c("Number_LG", "Letter_LG")) %>%
         mutate(LG.Is_Correct = coalesce(LLG.Is_Correct, NLG.Is_Correct)) %>%
         group_by(PID, Task) %>%
         summarize(LG.Mean_Correct = mean(LG.Is_Correct, na.rm = T)), 
       aes(x = Task, y = LG.Mean_Correct, group = PID)) + 
  geom_line() +
  geom_dotplot(binaxis = "y", stackdir = "center", 
               alpha = 0.5, 
               dotsize = 0.5, 
               aes(group = Task, 
                   fill = Task)) 
## `summarise()` has regrouped the output.
## Bin width defaults to 1/30 of the range of the data. Pick better value with
## `binwidth`.
## ℹ Summaries were computed grouped by PID and Task.
## ℹ Output is grouped by PID.
## ℹ Use `summarise(.groups = "drop_last")` to silence this message.
## ℹ Use `summarise(.by = c(PID, Task))` for per-operation grouping
##   (`?dplyr::dplyr_by`) instead.

Regression

Random structure: by-participant intercept

priors <- c(
  prior("normal(0,2.5)", class = "b") # weakly informative prior
)

Response in Give-Letter task with Expected Success Probability

we will calculate an Expected Success Probability, which is the probability of generating that set response based on the overall response distribution

TODO: redo this analysis with MN response distribution.

Correct set response (0/1) ~ 1 + offset(logit(Expected Success Probability) + Age + (1|subj) Result: 95% CI of Intercept > 0 –> performance above chance

gl_response_dist <- df.response %>%
  filter(Task == "Letter_Training") %>%
  count(LT.Final_Number_Given, name = "LT.N_Response") %>%
  mutate(
    LT.Prop_Response = LT.N_Response / sum(LT.N_Response)
  )

ggplot(gl_response_dist, 
       aes(x = LT.Final_Number_Given, y = LT.Prop_Response)) + 
  geom_col()

fit.lt_esp <- brm(formula = LT.Correct ~ 1 + offset(logit(LT.Prop_Response)) + age_zscored + (1|PID),
                      family = "bernoulli",
                      save_pars = save_pars(all = T),
                      data = df.response %>%
                        filter(Task == "Letter_Training") %>%
                        left_join(gl_response_dist, by = "LT.Final_Number_Given"),
                      prior = priors,
                      file = "./cache/lt_esp",
                      chains = 4,
                      iter = 20000,
                      warmup = 5000,
                      control = list(adapt_delta = 0.9),
                      refresh = 0,
                      seed = 1)

summary(fit.lt_esp)
##  Family: bernoulli 
##   Links: mu = logit 
## Formula: LT.Correct ~ 1 + offset(logit(LT.Prop_Response)) + age_zscored + (1 | PID) 
##    Data: df.response %>% filter(Task == "Letter_Training")  (Number of observations: 336) 
##   Draws: 4 chains, each with iter = 20000; warmup = 5000; thin = 1;
##          total post-warmup draws = 60000
## 
## Multilevel Hyperparameters:
## ~PID (Number of levels: 48) 
##               Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)     1.14      0.28     0.64     1.75 1.00    21363    31246
## 
## Regression Coefficients:
##             Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept       3.34      0.25     2.89     3.86 1.00    43826    41320
## age_zscored     0.64      0.24     0.19     1.13 1.00    44858    42367
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

Response in Give-Letter task

Correct set response (0/1) ~ Trial Type (Trained / Untrained) * Number + Age + (1|subj)

Result: Performance is greater than chance, but worse at Untrained numbers compared to Trained numbers. Better at smaller numbers. Interaction between Trial Type x Number (probably that there is a difference by Number magnitude for Trained numbers but not for Untrained numbers).

fit.lt <- brm(formula = LT.Correct ~ LT.Phase * LT.Number_Requested + age_zscored + (1|PID),
                      family = "bernoulli",
                      save_pars = save_pars(all = T),
                      data = df.response %>%
                        filter(Task == "Letter_Training"),
                      prior = priors,
                      file = "./cache/lt",
                      chains = 4,
                      iter = 20000,
                      warmup = 5000,
                      control = list(adapt_delta = 0.9),
                      refresh = 0,
                      seed = 1)

# Calculate BF to do Bayesian stopping if necessary.
fit.lt_comparison <- brm(formula = LT.Correct ~ LT.Number_Requested + LT.Phase:LT.Number_Requested + age_zscored + (1|PID),
                      family = "bernoulli",
                      save_pars = save_pars(all = T),
                      data = df.response %>%
                        filter(Task == "Letter_Training"),
                      prior = priors,
                      file = "./cache/lt_comparison",
                      chains = 4,
                      iter = 20000,
                      warmup = 5000,
                      control = list(adapt_delta = 0.9),
                      refresh = 0,
                      seed = 1)
summary(fit.lt)
##  Family: bernoulli 
##   Links: mu = logit 
## Formula: LT.Correct ~ LT.Phase * LT.Number_Requested + age_zscored + (1 | PID) 
##    Data: df.response %>% filter(Task == "Letter_Training") (Number of observations: 336) 
##   Draws: 4 chains, each with iter = 20000; warmup = 5000; thin = 1;
##          total post-warmup draws = 60000
## 
## Multilevel Hyperparameters:
## ~PID (Number of levels: 48) 
##               Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)     1.81      0.37     1.18     2.63 1.00    18798    28249
## 
## Regression Coefficients:
##                                       Estimate Est.Error l-95% CI u-95% CI Rhat
## Intercept                                 5.79      0.91     4.15     7.68 1.00
## LT.PhaseUntrained                        -3.66      1.14    -5.92    -1.48 1.00
## LT.Number_Requested                      -0.61      0.12    -0.86    -0.38 1.00
## age_zscored                               0.80      0.33     0.18     1.49 1.00
## LT.PhaseUntrained:LT.Number_Requested     0.38      0.19     0.01     0.75 1.00
##                                       Bulk_ESS Tail_ESS
## Intercept                                32943    36355
## LT.PhaseUntrained                        37247    38645
## LT.Number_Requested                      42217    39820
## age_zscored                              23816    29353
## LT.PhaseUntrained:LT.Number_Requested    39818    40767
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
bayes_factor(fit.lt, fit.lt_comparison)
## Iteration: 1
## Iteration: 2
## Iteration: 3
## Iteration: 4
## Iteration: 5
## Iteration: 1
## Iteration: 2
## Iteration: 3
## Iteration: 4
## Iteration: 5
## Estimated Bayes factor in favor of fit.lt over fit.lt_comparison: 110.37835
bf <- bayesfactor_parameters(fit.lt)
## Sampling priors, please wait...
bf <- bf %>% 
  select(-Effects, -Component) %>%
  mutate(BF = exp(log_BF))

Response magnitude in Give-Letter task

Set response ~ Trial Type (Trained / Untrained-Tested) * Number + Age + (1|subj)

Result: 95% CI of Number > 0 –> they do use larger numbers for larger requests. No interaction with Trial Type suggesting this is the case for both Trained and Untrained numbers.

fit.lt_size <- brm(formula = LT.Final_Number_Given ~ LT.Phase * LT.Number_Requested + age_zscored + (1|PID),
                      family = "gaussian",
                      save_pars = save_pars(all = T),
                      data = df.response %>%
                        filter(Task == "Letter_Training"),
                      prior = priors,
                      file = "./cache/lt_size",
                      chains = 4,
                      iter = 20000,
                      warmup = 5000,
                      control = list(adapt_delta = 0.9),
                      refresh = 0,
                      seed = 1)

summary(fit.lt_size)
##  Family: gaussian 
##   Links: mu = identity 
## Formula: LT.Final_Number_Given ~ LT.Phase * LT.Number_Requested + age_zscored + (1 | PID) 
##    Data: df.response %>% filter(Task == "Letter_Training") (Number of observations: 336) 
##   Draws: 4 chains, each with iter = 20000; warmup = 5000; thin = 1;
##          total post-warmup draws = 60000
## 
## Multilevel Hyperparameters:
## ~PID (Number of levels: 48) 
##               Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)     1.12      0.17     0.83     1.48 1.00    19637    29869
## 
## Regression Coefficients:
##                                       Estimate Est.Error l-95% CI u-95% CI Rhat
## Intercept                                 0.37      0.33    -0.27     1.01 1.00
## LT.PhaseUntrained                         1.30      0.67    -0.02     2.64 1.00
## LT.Number_Requested                       0.87      0.06     0.77     0.98 1.00
## age_zscored                              -0.19      0.19    -0.56     0.19 1.00
## LT.PhaseUntrained:LT.Number_Requested    -0.16      0.12    -0.41     0.07 1.00
##                                       Bulk_ESS Tail_ESS
## Intercept                                44567    44878
## LT.PhaseUntrained                        48914    42178
## LT.Number_Requested                      70059    47003
## age_zscored                              29274    33869
## LT.PhaseUntrained:LT.Number_Requested    47899    40665
## 
## Further Distributional Parameters:
##       Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sigma     1.76      0.07     1.62     1.92 1.00    58698    43889
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

Response in Letter LG task

Correct comparison (0/1) ~ Letter Distance (Consecutive / Non-consecutive) + Age + (1|subj)

Result: Performance better than chance.

fit.llg <- brm(formula = LLG.Is_Correct ~ LLG.Distance + age_zscored + (1|PID),
                      family = "bernoulli",
                      save_pars = save_pars(all = T),
                      data = df.response %>%
                        filter(Task == "Letter_LG"),
                      prior = priors,
                      file = "./cache/llg",
                      chains = 4,
                      iter = 20000,
                      warmup = 5000,
                      control = list(adapt_delta = 0.9),
                      refresh = 0,
                      seed = 1)

summary(fit.llg)
##  Family: bernoulli 
##   Links: mu = logit 
## Formula: LLG.Is_Correct ~ LLG.Distance + age_zscored + (1 | PID) 
##    Data: df.response %>% filter(Task == "Letter_LG") (Number of observations: 192) 
##   Draws: 4 chains, each with iter = 20000; warmup = 5000; thin = 1;
##          total post-warmup draws = 60000
## 
## Multilevel Hyperparameters:
## ~PID (Number of levels: 48) 
##               Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)     0.58      0.33     0.04     1.26 1.00    12948    21106
## 
## Regression Coefficients:
##                             Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS
## Intercept                       0.53      0.24     0.06     1.02 1.00    58696
## LLG.DistanceNonMconsecutive     0.41      0.32    -0.22     1.04 1.00    74608
## age_zscored                     0.32      0.19    -0.05     0.71 1.00    51457
##                             Tail_ESS
## Intercept                      39399
## LLG.DistanceNonMconsecutive    45314
## age_zscored                    39942
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

Response in How Many task with Expected Success Probability

Correct How Many response (0/1) ~ 1 + offset(logit(Expected Success Probability) + Age + (1|subj)

Result: Performance better than chance

hm_response_dist <- df.response %>%
  filter(Task == "How_Many") %>%
  count(HM.Final_Response, name = "HM.N_Response") %>%
  mutate(
    HM.Prop_Response = HM.N_Response / sum(HM.N_Response)
  )
fit.hm_esp <- brm(formula = HM.Is_Correct ~ 1 + offset(logit(HM.Prop_Response)) + age_zscored + (1|PID),
                      family = "bernoulli",
                      save_pars = save_pars(all = T),
                      data = df.response %>%
                        filter(Task == "How_Many") %>%
                        left_join(hm_response_dist, by = "HM.Final_Response"),
                      prior = priors,
                      file = "./cache/hm_esp",
                      chains = 4,
                      iter = 20000,
                      warmup = 5000,
                      control = list(adapt_delta = 0.9),
                      refresh = 0,
                      seed = 1)

summary(fit.hm_esp)
##  Family: bernoulli 
##   Links: mu = logit 
## Formula: HM.Is_Correct ~ 1 + offset(logit(HM.Prop_Response)) + age_zscored + (1 | PID) 
##    Data: df.response %>% filter(Task == "How_Many") %>% lef (Number of observations: 96) 
##   Draws: 4 chains, each with iter = 20000; warmup = 5000; thin = 1;
##          total post-warmup draws = 60000
## 
## Multilevel Hyperparameters:
## ~PID (Number of levels: 48) 
##               Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)     0.42      0.35     0.01     1.28 1.00    26147    26776
## 
## Regression Coefficients:
##             Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept       2.49      0.32     1.91     3.15 1.00    66090    35835
## age_zscored     0.44      0.33    -0.19     1.12 1.00    71615    39273
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

Response in How Many task

NOTE: NOT SURE ABOUT THIS SECTION. I think the spontaneous letter use analysis is more informative

Result: Better than chance(?)

fit.hm <- brm(formula = HM.Is_Correct ~ 1 + age_zscored + (1|PID),
                      family = "bernoulli",
                      save_pars = save_pars(all = T),
                      data = df.response %>%
                        filter(Task == "How_Many"),
                      prior = priors,
                      file = "./cache/hm",
                      chains = 4,
                      iter = 20000,
                      warmup = 5000,
                      control = list(adapt_delta = 0.9),
                      refresh = 0,
                      seed = 1)

summary(fit.hm)
##  Family: bernoulli 
##   Links: mu = logit 
## Formula: HM.Is_Correct ~ 1 + age_zscored + (1 | PID) 
##    Data: df.response %>% filter(Task == "How_Many") (Number of observations: 96) 
##   Draws: 4 chains, each with iter = 20000; warmup = 5000; thin = 1;
##          total post-warmup draws = 60000
## 
## Multilevel Hyperparameters:
## ~PID (Number of levels: 48) 
##               Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)     2.76      1.04     1.10     5.17 1.00    15114    24595
## 
## Regression Coefficients:
##             Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept       2.02      0.72     0.88     3.72 1.00    21798    26185
## age_zscored     1.16      0.64     0.06     2.60 1.00    27070    27382
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

Response in How Many task - Spontaneous Letter Use

Spontaneous use = use a letter before the explicit prompt to use the alphabet, doesn’t matter if it’s the correct letter or not.

How Many letter use (0/1) ~ 1 + Age + (1|subj)

Result: They do not spontaneously use letters. (note that it’s unclear what “chance” here is)

fit.hm_spontaneous <- brm(formula = HM.Spontaneous_Letter_Use ~ 1 + age_zscored + (1|PID),
                      family = "bernoulli",
                      save_pars = save_pars(all = T),
                      data = df.response %>%
                        filter(Task == "How_Many"),
                      prior = priors,
                      file = "./cache/hm_spontaneous",
                      chains = 4,
                      iter = 20000,
                      warmup = 5000,
                      control = list(adapt_delta = 0.9),
                      refresh = 0,
                      seed = 1)

summary(fit.hm_spontaneous)
##  Family: bernoulli 
##   Links: mu = logit 
## Formula: HM.Spontaneous_Letter_Use ~ 1 + age_zscored + (1 | PID) 
##    Data: df.response %>% filter(Task == "How_Many") (Number of observations: 96) 
##   Draws: 4 chains, each with iter = 20000; warmup = 5000; thin = 1;
##          total post-warmup draws = 60000
## 
## Multilevel Hyperparameters:
## ~PID (Number of levels: 48) 
##               Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)     0.62      0.46     0.03     1.72 1.00    15679    24493
## 
## Regression Coefficients:
##             Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept      -1.40      0.33    -2.11    -0.83 1.00    38212    26439
## age_zscored    -0.46      0.30    -1.07     0.09 1.00    50335    31921
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

Response in Number LG task

Correct comparison (0/1) ~ Number Distance (Consecutive / Non-consecutive) + Age + (1|subj)

Result: Performance better than chance.

fit.nlg <- brm(formula = NLG.Is_Correct ~ NLG.Distance + age_zscored + (1|PID),
                      family = "bernoulli",
                      save_pars = save_pars(all = T),
                      data = df.response %>%
                        filter(Task == "Number_LG"),
                      prior = priors,
                      file = "./cache/nlg",
                      chains = 4,
                      iter = 20000,
                      warmup = 5000,
                      control = list(adapt_delta = 0.9),
                      refresh = 0,
                      seed = 1)

summary(fit.nlg)
##  Family: bernoulli 
##   Links: mu = logit 
## Formula: NLG.Is_Correct ~ NLG.Distance + age_zscored + (1 | PID) 
##    Data: df.response %>% filter(Task == "Number_LG") (Number of observations: 192) 
##   Draws: 4 chains, each with iter = 20000; warmup = 5000; thin = 1;
##          total post-warmup draws = 60000
## 
## Multilevel Hyperparameters:
## ~PID (Number of levels: 48) 
##               Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)     0.54      0.39     0.02     1.45 1.00    21514    30671
## 
## Regression Coefficients:
##                             Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS
## Intercept                       1.98      0.37     1.34     2.78 1.00    55204
## NLG.DistanceNonMconsecutive     1.40      0.55     0.37     2.53 1.00    89132
## age_zscored                     0.87      0.30     0.31     1.49 1.00    65572
##                             Tail_ESS
## Intercept                      38176
## NLG.DistanceNonMconsecutive    44858
## age_zscored                    39370
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

Compare Number- and Letter-LG Responses

Correct comparison in Letter Later-Greater (0/1) ~ Correct comparison in Number Later-Greater + Age + (1|subj)

Result: Performance in Number-LG is not a significant predictor for the same trial in Letter-LG.

df.lg <- df.response %>%
  filter(Task %in% c("Letter_LG", "Number_LG")) %>%
  mutate(LG.Is_Correct = coalesce(LLG.Is_Correct, NLG.Is_Correct)) %>%
  select(PID, age_zscored, Task, Trial, LG.Is_Correct, NLG.Pair) %>%
  pivot_wider(
    names_from = Task, 
    values_from = c(LG.Is_Correct, NLG.Pair),
  ) %>%
  rename(
    LG.Pair = NLG.Pair_Number_LG
  ) %>%
  select(-NLG.Pair_Letter_LG)

table(df.lg$LG.Is_Correct_Letter_LG - df.lg$LG.Is_Correct_Number_LG) %>%
  barplot(
    xlab = "Difference in Accuracy (Letter - Number)",
    ylab = "Frequency",
    main = "Distribution of Accuracy Differences"
  )

df.lg_comparison <- brm(formula = LG.Is_Correct_Letter_LG ~ LG.Is_Correct_Number_LG + age_zscored + (1|PID),
                      family = "bernoulli",
                      save_pars = save_pars(all = T),
                      data = df.lg,
                      prior = priors,
                      file = "./cache/lg_comparison",
                      chains = 4,
                      iter = 20000,
                      warmup = 5000,
                      control = list(adapt_delta = 0.9),
                      refresh = 0,
                      seed = 1)

summary(df.lg_comparison)
##  Family: bernoulli 
##   Links: mu = logit 
## Formula: LG.Is_Correct_Letter_LG ~ LG.Is_Correct_Number_LG + age_zscored + (1 | PID) 
##    Data: df.lg (Number of observations: 192) 
##   Draws: 4 chains, each with iter = 20000; warmup = 5000; thin = 1;
##          total post-warmup draws = 60000
## 
## Multilevel Hyperparameters:
## ~PID (Number of levels: 48) 
##               Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)     0.54      0.32     0.03     1.20 1.00    15075    26489
## 
## Regression Coefficients:
##                         Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS
## Intercept                   0.14      0.49    -0.83     1.10 1.00    59141
## LG.Is_Correct_Number_LG     0.65      0.51    -0.34     1.66 1.00    67020
## age_zscored                 0.27      0.19    -0.10     0.65 1.00    47374
##                         Tail_ESS
## Intercept                  41939
## LG.Is_Correct_Number_LG    45296
## age_zscored                38072
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

Session Info

session_info()
## ─ Session info ───────────────────────────────────────────────────────────────
##  setting  value
##  version  R version 4.6.1 (2026-06-24)
##  os       macOS Golden Gate 27.2
##  system   aarch64, darwin23
##  ui       X11
##  language (EN)
##  collate  en_US.UTF-8
##  ctype    en_US.UTF-8
##  tz       America/Los_Angeles
##  date     2026-11-13
##  pandoc   3.10 @ /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-8      2024-09-12 [1] CRAN (R 4.6.0)
##  backports        1.5.1      2026-04-03 [1] CRAN (R 4.6.0)
##  base64enc        0.1-6      2026-02-02 [1] CRAN (R 4.6.0)
##  BayesFactor    * 0.9.12-4.8 2026-03-07 [1] CRAN (R 4.6.0)
##  bayesplot        1.15.0     2025-12-12 [1] CRAN (R 4.6.0)
##  bayestestR     * 0.18.1     2026-05-24 [1] CRAN (R 4.6.0)
##  boot           * 1.3-32     2025-08-29 [1] CRAN (R 4.6.1)
##  bridgesampling   1.2-1      2025-11-19 [1] CRAN (R 4.6.0)
##  brms           * 2.23.0     2025-09-09 [1] CRAN (R 4.6.0)
##  Brobdingnag      1.2-9      2022-10-19 [1] CRAN (R 4.6.0)
##  bslib            0.11.0     2026-05-16 [1] CRAN (R 4.6.0)
##  cachem           1.1.0      2024-05-16 [1] CRAN (R 4.6.0)
##  car            * 3.1-5      2026-02-03 [1] CRAN (R 4.6.0)
##  carData        * 3.0-6      2026-01-30 [1] CRAN (R 4.6.0)
##  checkmate        2.3.4      2026-02-03 [1] CRAN (R 4.6.0)
##  cli              3.6.6      2026-04-09 [1] CRAN (R 4.6.0)
##  cluster          2.1.8.2    2026-02-05 [1] CRAN (R 4.6.1)
##  coda           * 0.19-4.1   2024-01-31 [1] CRAN (R 4.6.0)
##  codetools        0.2-20     2024-03-31 [1] CRAN (R 4.6.1)
##  colorspace       2.1-3      2026-07-12 [1] CRAN (R 4.6.1)
##  data.table       1.18.4     2026-05-06 [1] CRAN (R 4.6.0)
##  datawizard       1.3.1      2026-04-26 [1] CRAN (R 4.6.0)
##  digest           0.6.39     2025-11-19 [1] CRAN (R 4.6.0)
##  distributional   0.8.1      2026-06-27 [1] CRAN (R 4.6.1)
##  dplyr          * 1.2.1      2026-04-03 [1] CRAN (R 4.6.0)
##  emmeans        * 2.0.4      2026-07-15 [1] CRAN (R 4.6.1)
##  estimability     2.0.0      2026-06-26 [1] CRAN (R 4.6.1)
##  evaluate         1.0.5      2025-08-27 [1] CRAN (R 4.6.0)
##  farver           2.1.2      2024-05-13 [1] CRAN (R 4.6.0)
##  fastmap          1.2.0      2024-05-15 [1] CRAN (R 4.6.0)
##  forcats        * 1.0.1      2025-09-25 [1] CRAN (R 4.6.0)
##  foreign          0.8-91     2026-01-29 [1] CRAN (R 4.6.1)
##  Formula          1.2-5      2023-02-24 [1] CRAN (R 4.6.0)
##  generics         0.1.4      2025-05-09 [1] CRAN (R 4.6.0)
##  ggplot2        * 4.0.3      2026-04-22 [1] CRAN (R 4.6.0)
##  glue             1.8.1      2026-04-17 [1] CRAN (R 4.6.0)
##  gridExtra        2.3.1      2026-06-25 [1] CRAN (R 4.6.1)
##  gtable           0.3.6      2024-10-25 [1] CRAN (R 4.6.0)
##  Hmisc            5.2-6      2026-06-19 [1] CRAN (R 4.6.0)
##  hms              1.1.4      2025-10-17 [1] CRAN (R 4.6.0)
##  htmlTable        2.5.0      2026-04-22 [1] CRAN (R 4.6.0)
##  htmltools        0.5.9      2025-12-04 [1] CRAN (R 4.6.0)
##  htmlwidgets      1.6.4      2023-12-06 [1] CRAN (R 4.6.0)
##  inline           0.3.21     2025-01-09 [1] CRAN (R 4.6.0)
##  insight          1.5.2      2026-06-28 [1] CRAN (R 4.6.1)
##  jquerylib        0.1.4      2021-04-26 [1] CRAN (R 4.6.0)
##  jsonlite         2.0.0      2025-03-27 [1] CRAN (R 4.6.0)
##  knitr            1.51       2025-12-20 [1] CRAN (R 4.6.0)
##  labeling         0.4.3      2023-08-29 [1] CRAN (R 4.6.0)
##  lattice          0.22-9     2026-02-09 [1] CRAN (R 4.6.1)
##  lifecycle        1.0.5      2026-01-08 [1] CRAN (R 4.6.0)
##  lme4           * 2.0-1      2026-03-05 [1] CRAN (R 4.6.0)
##  logspline        2.1.22     2024-05-10 [1] CRAN (R 4.6.0)
##  loo              2.10.1     2026-07-24 [1] CRAN (R 4.6.1)
##  lubridate      * 1.9.5      2026-02-04 [1] CRAN (R 4.6.0)
##  magrittr         2.0.5      2026-04-04 [1] CRAN (R 4.6.0)
##  MASS             7.3-65     2025-02-28 [1] CRAN (R 4.6.1)
##  Matrix         * 1.7-5      2026-03-21 [1] CRAN (R 4.6.1)
##  MatrixModels     0.5-4      2025-03-26 [1] CRAN (R 4.6.0)
##  matrixStats      1.5.0      2025-01-07 [1] CRAN (R 4.6.0)
##  minqa            1.2.8      2024-08-17 [1] CRAN (R 4.6.0)
##  mvtnorm          1.4-2      2026-07-12 [1] CRAN (R 4.6.1)
##  nlme             3.1-169    2026-03-27 [1] CRAN (R 4.6.1)
##  nloptr           2.2.1      2025-03-17 [1] CRAN (R 4.6.0)
##  nnet             7.3-20     2025-01-01 [1] CRAN (R 4.6.1)
##  otel             0.2.0      2025-08-29 [1] CRAN (R 4.6.0)
##  pbapply          1.7-4      2025-07-20 [1] CRAN (R 4.6.0)
##  pillar           1.11.1     2025-09-17 [1] CRAN (R 4.6.0)
##  pkgbuild         1.4.8      2025-05-26 [1] CRAN (R 4.6.0)
##  pkgconfig        2.0.3      2019-09-22 [1] CRAN (R 4.6.0)
##  plyr             1.8.9      2023-10-02 [1] CRAN (R 4.6.0)
##  posterior        1.7.0      2026-04-01 [1] CRAN (R 4.6.0)
##  purrr          * 1.2.2      2026-04-10 [1] CRAN (R 4.6.0)
##  QuickJSR         1.10.0     2026-05-17 [1] CRAN (R 4.6.0)
##  R6               2.6.1      2025-02-15 [1] CRAN (R 4.6.0)
##  rbibutils        2.4.1      2026-01-21 [1] CRAN (R 4.6.0)
##  RColorBrewer     1.1-3      2022-04-03 [1] CRAN (R 4.6.0)
##  Rcpp           * 1.1.2      2026-07-05 [1] CRAN (R 4.6.1)
##  RcppParallel     5.1.11-2   2026-03-05 [1] CRAN (R 4.6.0)
##  Rdpack           2.6.6      2026-02-08 [1] CRAN (R 4.6.0)
##  readr          * 2.2.0      2026-02-19 [1] CRAN (R 4.6.0)
##  reformulas       0.4.4      2026-02-02 [1] CRAN (R 4.6.0)
##  reshape2         1.4.5      2025-11-12 [1] CRAN (R 4.6.0)
##  rlang            1.3.0      2026-07-05 [1] CRAN (R 4.6.1)
##  rmarkdown        2.31       2026-03-26 [1] CRAN (R 4.6.0)
##  rpart            4.1.27     2026-03-27 [1] CRAN (R 4.6.1)
##  rstan            2.32.7     2025-03-10 [1] CRAN (R 4.6.0)
##  rstantools       2.7.0      2026-07-26 [1] CRAN (R 4.6.1)
##  rstudioapi       0.19.0     2026-06-11 [1] CRAN (R 4.6.0)
##  S7               0.2.2      2026-04-22 [1] CRAN (R 4.6.0)
##  sass             0.4.10     2025-04-11 [1] CRAN (R 4.6.0)
##  scales           1.4.0      2025-04-24 [1] CRAN (R 4.6.0)
##  sessioninfo    * 1.2.4      2026-06-04 [1] CRAN (R 4.6.0)
##  StanHeaders      2.32.10    2024-07-15 [1] CRAN (R 4.6.0)
##  stringi          1.8.7      2025-03-27 [1] CRAN (R 4.6.0)
##  stringr        * 1.6.0      2025-11-04 [1] CRAN (R 4.6.0)
##  tensorA          0.36.2.1   2023-12-13 [1] CRAN (R 4.6.0)
##  tibble         * 3.3.1      2026-01-11 [1] CRAN (R 4.6.0)
##  tidyr          * 1.3.2      2025-12-19 [1] CRAN (R 4.6.0)
##  tidyselect       1.2.1      2024-03-11 [1] CRAN (R 4.6.0)
##  tidyverse      * 2.0.0      2023-02-22 [1] CRAN (R 4.6.0)
##  timechange       0.4.0      2026-01-29 [1] CRAN (R 4.6.0)
##  tzdb             0.5.0      2025-03-15 [1] CRAN (R 4.6.0)
##  utf8             1.2.6      2025-06-08 [1] CRAN (R 4.6.0)
##  vctrs            0.7.3      2026-04-11 [1] CRAN (R 4.6.0)
##  withr            3.0.3      2026-06-19 [1] CRAN (R 4.6.0)
##  xfun             0.60       2026-07-09 [1] CRAN (R 4.6.1)
##  xtable           1.8-8      2026-02-22 [1] CRAN (R 4.6.0)
##  yaml             2.3.12     2025-12-10 [1] CRAN (R 4.6.0)
## 
##  [1] /Library/Frameworks/R.framework/Versions/4.6/Resources/library
##  * ── Packages attached to the search path.
## 
## ──────────────────────────────────────────────────────────────────────────────