[R-sig-ME] Using lme function in R in a brain imaging study

Phillip Alday Phillip.Alday at unisa.edu.au
Wed Apr 5 06:40:04 CEST 2017


Dear IIlgim,

If I'm understanding your design correctly, then you have you crossed random effects -- you can think of participants as being nested within trials or trials as being nested within participant. I would recommend using lme4 instead of nlme for such designs.

I am not familiar with the specifics of fNIRS, but I'm guessing that the statistical analysis is somewhat similar to EEG, at least in terms of sensor placement, even if the units of measurement and temporal resolution are quite different. As such, it might make sense for you to look at resources discussing mixed models for EEG / ERP, including posts like this https://stat.ethz.ch/pipermail/r-help/2015-September/432520.html (by me).

You will also find a lot of resources from psycholinguistics, but the literature there often uses the terms "items" and "subjects" instead of "trials" and "participants", but these are essentially the same thing. In your case, you only have three trials per conditions, so you can't model that as a random effect (grouping variable). There are all sorts of rules of thumb for how many levels you need, but I generally wouldn't let something be a grouping variable (see below) with less than about 10 levels.

I'm not sure I would treat your n-back conditions as categorical -- if you treat n-back as a continuous variable, then you can make predictions about the response for arbitrary n. It depends on whether or not you expect the response to change in a linear fashion. If you don't, then treat the different types of n-back as categorical. (There are other ways to address non-linearity, but they may be a bit much for now.)  

There are also seems to be some terminological confusion around "random variables". You need to distinguish between the grouping variables (the stuff behind the vertical bar |), which are always discrete, and the "random slopes" (the stuff before the vertical bar |), which are predictors like any other and can be categorical or continuous. The trick is to read the vertical bar | as "by", so 

predictor | participant

is just "allow the strength of this predictor to vary by participant".

All that said, I would try something like the following (assuming you have enough participants to fit all these parameters):

library(lme4)

model <- lmer(nirs_response ~ NbackType * Trial * roi + (1 + NbackType |  participant), 
 data=oxyHbConditionandTrialCellbyCell, REML=FALSE)

model.gender <- update(model, . ~ . * gender)

anova(model, model.gender)

----

"roi" stands for "region of interest". For computational simplicity and model parsimony, I would not try to do things by sensor, but rather by groups of adjacent sensors (ROIs).  You can average across sensors to produce a single value for each ROI, which will also simplify things a bit.

Best,
Phillip




> On 1 Apr 2017, at 22:40, Ilgim Hepdarcan <ilgim.hepdarcan at izmirekonomi.edu.tr> wrote:
> 
> Dear all, 
> my study consists of 3 trials and each trial includes four different n-back types, 0-,1-,2-,3-back. Each participant had 12 n-back conditions, in a different order. Therefore, my design is a mixed design in which each participant were showed each n-back condition, which is a within-subject factor. Participants and gender of the participants are between-subject factors. 
> 
> 
> While participants were performing n-back task, I have measured their dorsolateral prefrontal cortex activation via 16-channeled fNIR and obtained oxygenated hemoglobin measures from each of the 16 channels. Therefore, 16 oxygenated hemoglobin measures are my dependent variables. When I've checked examples on Internet, I always faced with examples of random variables which are continuous variables, like time or treatment. Because my random variables Trials and Nback Types (0-, 1-, 2-, and 3-back) are categorical variables, I've confused when I construct my multilevel model in R. Also, in my model repeated measures are nested within participants. 
> 
> 
> 
> 
> Last but not least, I wonder if it is okay to construct my model based in two-way repeated measures anova using lme function in R? 
> 
> 
> 
> 
> 
> 
> 
>> library(nlme) 
> 
>> nullmodel = lme(Optode1 ~ 1, 
> 
> + random = ~1|participant/Trial/NbackType, 
> 
> + data = oxyHbConditionandTrialCellbyCell, 
> 
> + na.action = na.exclude, 
> 
> + method = "ML") 
> 
>> summary(nullmodel) 
> 
> 
> 
> 
>> NbackType_Trial = update(baseline, .~. + NbackType*Trial) 
> 
>> summary(NbackType_Trial) 
> 
> 
> 
> 
>> NbackType_Trial_gender = update(NbackType_Trial, .~. + NbackType*Trial*gender) 
> 
>> summary(NbackType_Trial_gender) 
> 
> 
> 
> 
> 
> 
>> anova(nullmodel,NbackType_Trial,NbackType_Trial_gender) 
> 
> 
> 
> 
> 
> 
> 
> 
> Thank you in advance, 
> 
> Ilg�m Hepdarcan 
> Izmir University of Economics 
> Experimental Psychology MD 
> 
> 
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



More information about the R-sig-mixed-models mailing list