I was dealing with the lme4 package in R and was a bit confused with how to interpret the random effects in a following example:

setwd("F:/5_1 Analize/Article_2 - LMM/")

dat <- data.frame(
  ID = rep(1:20, each = 60),
  Task = rep(1:60, each = 20),
  Group = rep(c("A","B","C"), each = 20),
  Accuracy = sample(c(0,1), size = 1200, replace = T),
  RT = sample(200:3000, size = 1200, replace = T)

mod <- glmer(Accuracy~RT*Group + (1+RT|Task) + (1+RT|ID), data = dat, family = "binomial")

Basically, every participant (variable ID) goes through 3 conditions (Group). In each condition, there are 20 trials (Task; Task is each single trial a person goes through in the experiment - there are 60 trials, and all of them are different. First 20 are in condition/group A, next 20 in condition B, and last 20 in group C).

We measure Accuracy and reaction time. In the modeling we want to predict Accuracy from RT, controlling for random effects between subjects and tasks, both for intercepts and slopes. We also control for the fixed effect of the group.

The formula of the example can be described as:

Accuracy ~ (beta0 + b0ID + b0Task + betaGroup0) + (beta1 + b1ID + b1Task + betaGroup1)*RT

(b-random effects, beta - fixed effects)

My question is following:

1) When I run coef(mod)$ID and look at the Intercept column - what do I see? Do I see random intercepts for each person across all three conditions (i.e., on all Tasks), or do I see random intercepts for each person for Group A? My idea is the second one. If that is true, how can I get an average random person intercept for all three groups?

2) When I run coef(mod)$Task and also look at Intercept column - do I see intercepts for each item independently of Group variable or not?

  • $\begingroup$ I'm getting warnings of failing to converge and largely unidentified... Do you get this as well? $\endgroup$ – Mark White Jun 19 '17 at 23:59
  • $\begingroup$ +1 to Mark White. I get the same warnings/errors. Consider rescaling the RT values (eg. divide by 1000) and potentially not fitting correlation terms between the random slopes and intercepts (eg. (0+RT|Task) + (0+RT|ID)). $\endgroup$ – usεr11852 Jun 20 '17 at 0:25
  • $\begingroup$ show your results. $\endgroup$ – Subhash C. Davar Jun 20 '17 at 2:32
  • $\begingroup$ I am sorry, this example was just for the sake of you seeing the type of data frame I am using. I am not so skilled in reproducing the same pattern, or any sensible pattern of results. My question is more a theoretical one... But if someone can help me build a better example, I have an open ear. $\endgroup$ – User33268 Jun 20 '17 at 7:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.