0
$\begingroup$

I have data of an experiment where subjects (ID) have to perform 10 trials of a go/no-go task. I want to study the influence of the decision (go/no-go) on some physiological measure (e.g. pupil.diameter) during trial. I want to study that alongside other variables, some dependant on the subject (e.g. age), and other dependant on the trial (e.g. difficulty).

My data looks like this:

    ID  trial   decision   pupil.diameter   age      difficulty
0   1   1       go         3.2              47       easy
1   1   2       go         2.4              47       hard
2   1   3       no-go      5.6              47       hard
3   1   4       go         5.1              47       hard
.   .   .       .          .                .        .
9   1   10      go         3.4              47       easy
10  2   1       no-go      3.6              29       easy
11  2   2       go         4.2              29       hard
.   .   .       .          .                .        .

I would originally perform (under R) linear model/anova analyses like this: pupil.diameter ~ age + difficulty + decision with possibly interaction effects.

The problem is that some of my variables are dependant either on the ID or the trial (and thus their values repeated across multiple lines).

My search led me to consider a mixed-effects model and to use lmer, but I am still confused on how to do it correctly.


Is a mixed-effects model suitable here?

How to specify the random effects correctly?

Should I declare my model like this?

pupil.diameter ~ age + difficulty + decision + (1|ID)

Or like this???

pupil.diameter ~ age + difficulty + decision + (1|trial)

pupil.diameter ~ age + difficulty + decision + (1|ID) + (1|trial)

pupil.diameter ~ age + difficulty + decision + (age|ID) + (difficulty|trial)


NB: To generalise the example:

  • subject-dependant variables could also be categorical (e.g. gender);

  • trial-dependant variables could also be continuous (e.g. difficulty on a scale of 1 to 10);

  • variable to explain could also be categorical (e.g. blinked.during.trial?) and the model would be adapted to a logistic regression;

  • etc.

$\endgroup$
0
$\begingroup$

You're right, this is definitely a good situation for a mixed model. The random intercepts/slopes you use depends on a few factors, such as the desired interpretation and power. I would start at the simplest (random intercept) model, and add your random effects in terms of importance; because without a huge sample you can run into issues with convergence. So starting off with

pupil.diameter ~ (1|ID) + age + difficulty + decision

which gives each subject their own intercept, then adding single random effects from there. I think this could be what you are looking for when it comes to fitting an lme4 mixed model in R. This also shows how to use the nlme package, in-case that makes more sense naturally.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.