Hi all — I’m fitting a multivariate model in brms
with the aim to extract latent abilities for two tasks (CFMT and EGEFACE), each modeled as Bernoulli (logit), with task-specific random intercepts per participant, and trial-level intercepts. The two tasks are basically face recognition measures with each trial being 0/1 (incorrect/correct).
The formula looks like:
response ~ 0 + task + (0 + task | p | person) + (1 | trial_id)
From what I understand: (but I need handholding)
- To reiterate, my basic aim here is to essentially extract some form of person specific ‘latent ability’ values for each of the two tasks and correlate them - in this case the ‘latent ability’ is conceptually linked to the task- specific random intercepts - what is key (if I haven’t got the wrong end of the stick) is that apparently this
p
ID links the deviations and allows brms to estimate a correlation.
Does this look correct for modeling latent person-level accuracy across two tasks?
Anything you’d recommend tweaking? Or needs basic correction?
Thanks in advance! - fuller code is below -
df_long ← df_long %>%
mutate(
task = factor(task, levels = c(“CFMT”, “EGEFACE”)),
response = as.integer(response),
trial_id = interaction(task, trial, drop = TRUE)
)
fit_long_phase1 ← brm(
response ~ 0 + task +
(0 + task | p | person) +
(1 | trial_id),
data = df_long,
family = bernoulli(link = “logit”),
chains = 4,
cores = 4,
iter = 8000,
warmup = 3000,
seed = 123,
control = list(
adapt_delta = 0.995,
max_treedepth = 20
)
)
print(summary(fit_long_phase1), digits = 3)
cor_post ← posterior_summary(fit_long_phase1, variable = “cor_person__taskCFMT__taskEGEFACE”)
print(cor_post)