# RT as a random effect in LME for fMRI data?

Hello,
I was looking at the documentation of 3dLME, trying to understand if this is what I need for my own data:
https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dLME.html
My data also has RT per condition per subject, similar to Example2. Originally, I was thinking of adding RTs as a predictor to the analysis, but then I reckoned it was a bad idea as it correlates with the Condition predictor. I see that in Example2 in the documentation, RT is added as a random effect. What is the meaning of RT being a random effect?
Perhaps I am confused from what I know about mixed models in regular behavioral experiments: usually the random effect is subjects (or any other random grouping criterion), because that’s randomly sampled from the population. How is RT a random grouping variable?
In analogy, an R formula would look something like this:
lmer(BOLD ~ Cond*RT + age + (Cond|RT))
And this I don’t understand conceptually. I suppose my concept is wrong. I would very much appreciate your help in understanding this.
Thanks,
Galit

Galit,

Originally, I was thinking of adding RTs as a predictor to the analysis, but then
I reckoned it was a bad idea as it correlates with the Condition predictor. I see
that in Example2 in the documentation, RT is added as a random effect. What
is the meaning of RT being a random effect?

This is a very good question! When the RT is correlated with a within-subject factor (Condition in your case), I recommend that you center the RT value within each Condition level before you feed the RT values into 3dLME. Even though the following page only covers the situation with as between-subjects factor (multiple groups), it might be helpful to understand the concept and mechanism:

https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/STATISTICS/center.html

The point of incorporating RT as an explanatory variable is to account for RT variability across subjects within each level (condition in your case).

In analogy, an R formula would look something like this:
lmer(BOLD ~ Cond*RT + age + (Cond|RT))

The model for Exam 2 is actually this:

lmer(BOLD ~ Cond*RT + age + (RT|subjects)

Other models are possible, but currently not strictly implemented:

mer(BOLD ~ Cond*RT + age + (RT|subjects) + (Cond|subjects)

Thank you, Gang!
But then there is only one RT (the average) per condition for each subject. So that makes only four data points per subject to adjust for between-subject variability in RT. Isn’t that too little?
Also, isn’t it problematic that both Cond and RT are used as predictors but they are highly correlated?
Thanks again,
Galit

But then there is only one RT (the average) per condition for each subject. So that makes
only four data points per subject to adjust for between-subject variability in RT. Isn’t that too little?

That should be fine. It’s the number of subjects that matters the most.

isn’t it problematic that both Cond and RT are used as predictors but they are highly correlated?

By being “highly correlated”, do you mean that the average RT for one condition is higher than the other? If so, the centering strategy I mentioned previously (centering within each condition) should take care of the issue in addition to maintaining the interpretation integrity of the condition effect.

Right, I now noticed that you did write about centering, sorry. Thanks, that seems like a simple solution to solve this! I understand that the default in -qVarCenters is centering across everything, so I should centre myself within each level, right?

I am still confused, though, about something: what is the gain in adding RT as a random effect? You wrote that it accounts for “RT variability across subjects within each level” - I think I don’t understand the “within each level” thing… How does the fact that RT is subdivided by Cond enters into the analysis? Doesn’t (RT|Subject) mean that the average RT is adjusted per subject?

I will try to summarize my understanding of this, perhaps it will help pinpointing the source of my confusion:

The purpose of adding RT to the analysis is to remove variability which is accounted by differences in general speed between subjects (which is not a difference of interest for this experiment), thus making the data cleaner. This is basically like an ANCOVA, but the use of LMER instead of ANCOVA allows to account for the covariance structure (e.g. slow subjects might have a weaker effect in Cond?).
My understanding of mixed effects is that it allows for a better generalizability of the effect of interest by accounting for the distribution of the effect across subjects. Since the effect of interest is really Cond and not RT, wouldn’t it be preferable to have Cond as a random effect rather than RT? I.e.:
BOLD ~ Cond*RT + age + (Cond|Subject)
In that case, in the AFNI command, I should put just
-ranEff “~1+Cond”

Am I correct? Where am I wrong?

Sorry for the length, I hope I was clear in my question,
Thank you so much again, This is really helpful!

Galit

I understand that the default in -qVarCenters is centering across everything, so I
should centre myself within each level, right?

Yes, that’s right: you should center the variable within each level yourself before feeding into the data table.

what is the gain in adding RT as a random effect? You wrote that it accounts for “RT
variability across subjects within each level” - I think I don’t understand the “within
each level” thing… How does the fact that RT is subdivided by Cond enters into the
analysis? Doesn’t (RT|Subject) mean that the average RT is adjusted per subject?

There are two reasons for incorporating a variable (e.g., RT in your case) in a model: 1) you’re interested in the effect of the variable, and 2) you would like to account for the variability in the data due to this variable.

For the second reason above, another way to say it is that you want to control the variable at a specific value, which is what centering is about. How you center the variable may have a huge impact on the results as well as the interpretation of the results. For example, if you center the variable at the overall mean in your case, you may face the following problem, which is basically associated with the fact that the two conditions are correlated with the RT values: does it make sense to compare the two conditions if RT is fixed at the overall mean while you already know that the two conditions have different average RT?

Thank you, Gang!

As you said, I definitely want to control for the variability of RT, and clean out its contribution from the overall variability. Because of collinearity, as you said, I should center within each condition, no matter how I do it. I just wonder about two things (and perhaps I just didn’t fully understand your previous answers, so my apologies if so):

1. If the point is removing irrelevant variability from the data and I’m not interested in RT per se, why should I put it as a random effect and not a fixed effect in the first place? It seems more relevant to put Cond as the random effect (adjust it by subjects).

2. I actually have Cond1 (2 levels) and Cond2 (2 levels). So the fact that I have four RTs per subject - one per Cond1*Cond2 combination - is unclear to me… Can RT be both a within- and a between- predictor? If so then this is new to me, I can’t think how this is implemented mathematically. After centering, we expect no within-subject effect of RT anyway. So why don’t we just give one number which is the average for each subject (across Con1 and Cond2), thus it is just a between-subject covariate?

Thanks,

Galit

If the point is removing irrelevant variability from the data and I’m not interested in RT per se, why
should I put it as a random effect and not a fixed effect in the first place? It seems more relevant
to put Cond as the random effect (adjust it by subjects).

Ideally you want to model both the cross-subject variability in terms of RT effect and the cross-subject variability among those conditions (and their variance-covariance structure). However, 3dLME currently does not have the functionality to specify cross random effects (possible in the future), so you’d have to choose one at the moment.

I actually have Cond1 (2 levels) and Cond2 (2 levels). So the fact that I have four RTs per subject -
one per Cond1*Cond2 combination - is unclear to me… Can RT be both a within- and a between-
predictor? If so then this is new to me, I can’t think how this is implemented mathematically. After
centering, we expect no within-subject effect of RT anyway.

No, centering would not change anything about the RT effect itself. Instead it artificially shift the center value among the subjects, and in the end it won’t have any impact on the RT effect estimate. What it changes is the following: 1) maintaining the integrity of the interpretation for other effects such as condition effect in your case, 2) avoiding potential correlation (collinearity) between RT and conditions.

So why don’t we just give one number which is the average for each subject (across Con1 and
Cond2), thus it is just a between-subject covariate?

Such a combining step would involve information loss and render inferior modeling.