Skip to content

Instantly share code, notes, and snippets.

@mcfrank
Created February 8, 2023 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcfrank/d398ab1d0414f012b4e133bae75da91f to your computer and use it in GitHub Desktop.
Save mcfrank/d398ab1d0414f012b4e133bae75da91f to your computer and use it in GitHub Desktop.
# starts at line 716 of paper.Rmd
d_lmer_scale <- d %>%
filter(trial_type != "train") %>%
mutate(log_lt = log(looking_time),
age_mo = scale(age_mo, scale = FALSE),
trial_num = trial_num - 8.5,
item = paste0(stimulus_num, trial_type)) %>%
filter(!is.na(log_lt), !is.infinite(log_lt))
contrasts(d_lmer_scale$nae) <- c(-.5,.5)
d_lmer_scale$method <- factor(d_lmer_scale$method)
contrasts(d_lmer_scale$method) <- contr.sum(3)
mod_lmer <- lmer(log_lt ~ trial_type * method +
trial_type * trial_num +
age_mo * trial_num +
trial_type * age_mo * nae +
(1 | subid_unique) +
(1 | item) +
(1 | lab),
data = d_lmer_scale)
# fixed effect / residual standard deviation
fixef(mod_lmer)[2]/summary(mod_lmer)[[11]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment