Skip to main content
1 of 2

multiple samples from each subject: nested random effect in lmer?

I have a simple design: one dependent variable (brain activity), a factor I manipulated with two levels (ct1 and ct2) and patients participated in both levels. So far so good. But for each patient, I have a varying number of electrodes on which I measured brain activity (example below). E.g.,

patient electrode activity condition
p9        c1      0.2444       ct1
p9        c1      0.0687       ct2
p10       c1      0.6818       ct1
p10       c1      1.2667       ct2
p10       c2     -0.2677       ct1
p10       c2      0.3216       ct2
p11       c1      0.1542       ct1
p11       c1      0.4452       ct2

I know the samples (sampled for each electrode) for each patient are dependent and that needs to be accounted for.

A detail that could be of importance: I cannot assume that electrode c1 in p9 has any relation to c1 in p10, c1 in p11, etc. This is because clinical necessity dictates where these patients will have electrodes. So even though all patients have at least one electrode (c1), this is rather a random label. For a patient with 5 electrodes, for instance, I can call any one of them "c1", which will still be different from "c1" in the next patient.

At first I was considering electrodes to be nested under patient and was modelling it as

lmer(activity ~ condition  + (1|patient/electrode) , data = data)

But then I read more on nested random effects and it became less clear to me whether I should nest electrodes under patients, or simply have patients as one random effect

lmer(activity ~ condition  + (1|patient) , data = data)

This latter model would take care of the fact that I can have more than one electrode (i.e., dependent observations) for each patient, right? I guess the main reason I'm confused is because these electrodes are conceptually intrinsic to each patient and I'm probably reading more into this fact than I'd need for the statistics. Any thoughts?