Longitudinal 3dlmer with 2 quantitative variables

Hello,

I’ve successfully implemented 3dlmer for longitudinal models where I’ve include both an age and age2 term (continuous, quantitative measure) and assessed gender differences (binary 0/1 coding).


3dLMEr -prefix 3dLMEr_age2_gender -jobs 28 \
 -model 'task*age*gender+task*age2*gender+(age|Subj)' \
 -qVars "age,age2" \
 -qVarCenters "0,0" \

An example contrast:


-gltCode  age2.rew-pun.gender   'task : 1*rew -1*pun gender : 1*female -1*male age2 : ' \

I’m curious if I can do a similar analysis, but instead of a binary outcome, if I can use another continuous, quantitative variable (e.g., cortisol values at one time point and/or multiple time points).

For example:


3dLMEr -prefix 3dLMEr_age2_gender -jobs 28 \
 -model 'task*age*cortisol+task*age2*cortisol+(age|Subj)' \
 -qVars "age,age2" \
 -qVarCenters "0,0" \

I tried it with the base model and it ran okay, but when I try to add contrasts that include both continuous quantitative variables, I get this error.


Error in seq.default(2, length(sepTerms), 2) :
  wrong sign in 'by' argument
Calls: process.LME.opts -> gl_Constr -> glfConstr -> seq -> seq.default
In addition: Warning messages:
1: In if (is.na(code[[n]][QVpos + 2])) { :
  the condition has length > 1 and only the first element will be used
2: In if (QVpos == 1) outList[[1]][[n]] <- NA else outList[[1]][[n]] <- glfCons$
  the condition has length > 1 and only the first element will be used
3: In QVpos:(QVpos + 2) :
  numerical expression has 2 elements: only the first used
4: In QVpos:(QVpos + 2) :
  numerical expression has 2 elements: only the first used
Execution halted

I assumed it wouldn’t allow me to do this


-gltCode  age2.rew-pun.cort   'task : 1*rew -1*pun cortisol : age2 : ' \

but I thought maybe this would work, but it still doesn’t like two quantitative variables in the same contrast


-gltCode  Val_age2med   'task : 1*rew +1*pun cortisol : 5 age2 : 60' \

My guess is that I cannot create a con with both included, without making one of the variables binary, but I wanted to make sure I understand correctly or if there is another way to have a contrast include two quantitative continuous variables.

Other suggestions on how to ask this type of question in this modeling framework?
(edit: question being- do cortisol values moderate longitudinal trajectories in task fMRI patterns of brain activity)

Thanks!!

I’ve successfully implemented 3dlmer for longitudinal models where I’ve include both an age and age2 term
(continuous, quantitative measure) and assessed gender differences (binary 0/1 coding).

Did you really code gender as 0/1 instead of a factor?

-gltCode age2.rew-pun.cort 'task : 1rew -1pun cortisol : age2 : ’ \

This inference does not make sense: what does it mean when you want to obtain both slope effects at the same time?

-gltCode Val_age2med ‘task : 1rew +1pun cortisol : 5 age2 : 60’ \

This one is meaningful, but 3dLMEr currently does not support it. One workaround solution is to center one variable around the value you are interested (e.g., cortisol at 5), and then try

-gltCode Val_age2med ‘task : 1rew +1pun cortisol : 5 age2 : 60’
(Note: age2 at 60 should be relative to the centered age value)

Or center both variables (e.g., e.g., cortisol at 5 age2 at 60), and add

-gltCode Val_age2med ‘task : 1rew +1pun’

Hi Gang,

This answers my questions!
Yes, my gender was indeed a factor, not binary 0/1.

Thank you so much!