# Linear Regression Analysis

AFNI experts,

I am currently analyzing a data where participants underwent a memory task after two conditions (condition A and B). I already have analyzed the data using 3dttest+ by comparing the difference between the two conditions. I also would like to include a covariate (year of training) to the analysis. What I can think of is to extract the activation intensities using 3dmaskave and analyzing the activation of each condition with the covariate using SPSS or R. Is there any way I add the covariate and run multiple regression in AFNI which can show the interaction between condition and the covariate in the image?

Jun

Jun,

What I can think of is to extract the activation intensities using 3dmaskave and analyzing the activation of each condition with the covariate using SPSS or R.

You may lose much information or even distort the big picture if you do that.

Is there any way I add the covariate and run multiple regression in AFNI which can show the interaction between condition and the covariate in the image?

Does the year of training vary between the two conditions for each subject?

Hi Gang,

Thanks for the response. The standard deviation of training year is 11. Other variables we are also interested have SD of 23 and 70. Does this variability matter in the analysis?

Best,
Jun

Sorry, I meant to ask: Does the average year of training across subjects vary between the two conditions?

My apologies as I confused you. This study has a within-subject design where participants performed two conditions on different days. So there is no difference in covariates between conditions as those are the same for both conditions.

Since you have one within-subject factor (with 2 levels) plus a between-subjects quantitative variable, use 3dMVM.

Hi Gang,

Thank you so much for your advice. It really helps. I have one more question to ask.
I have treated training year as a between-subject variable at first and found that the script did not run. After reading afni’s 3dMVM instruction, it seems that between-subject variables are for categorical variables such as sex, genotype or group. So I have added training year as a quantitative variable and the script is running. Could you please check if adding training year as a quantative variable?

3dMVM -prefix Regression
-qVars ‘Training’
-wsVars ‘Condition’
-num_glt 1
-gltLabel 1 ‘CondtionA-ConditionB’ -gltCode 1 ‘TST : 1A Training : 1A -1*B’
-dataTable
Subj Training Condition InputFile
s1 8 A ‘stats.s1.A+tlrc.BRIK[10]’
s1 8 B ‘stats.s1.B+tlrc.BRIK[10]’
s2 20 A ‘stats.s2.A+tlrc.BRIK[10]’
s2 20 B ‘stats.s2.B+tlrc.BRIK[10]’
.
.
.
.
.

Thanks,

‘Training’ is a between-subjects quantitative variable (not factor). In addition to the following,

-qVars ‘Training’ \

-bsVars ‘Training’ \

Hi Gang,

Thanks for the help again.

3dMVM -prefix Regression \
-qVars ‘Training’ \
-bsVars ‘Training’
-wsVars ‘Condition’ \
-num_glt 1 \
-gltLabel 1 ‘CondtionA-ConditionB’ -gltCode 1 ‘TST : 1A Training : 1A -1*B’ \
-dataTable \
Subj Training Condition InputFile \
s1 8 A ‘stats.s1.A+tlrc.BRIK[10]’ \
s1 8 B ‘stats.s1.B+tlrc.BRIK[10]’\
s2 20 A ‘stats.s2.A+tlrc.BRIK[10]’ \
s2 20 B ‘stats.s2.B+tlrc.BRIK[10]’ \
.
.

Unfortunately, I got an error message after adding -bsVars ‘Training’ \ like above and had a hard time to figure out how to address the error message below. Could you please help me with how to solve this?

[1] “Great, test run passed at voxel (21, 38, 32)!”
Error in gltRes[[ii]][, 6] : incorrect number of dimensions
Calls: ifelse
Execution halted

Thank you,

-gltLabel 1 ‘CondtionA-ConditionB’ -gltCode 1 ‘TST : 1A Training : 1A -1*B’ \

Since ‘Training’ is quantitative variable, the last part in the above does not make sense. What exactly are you trying to test?

Thanks Gang. What I would like to look at is the interactive effects of Condition and Training year. Am I on the right track to examine this?

-gltLabel 1 ‘CondtionA-ConditionB’ -gltCode 1 ‘TST : 1A Training : 1A -1*B’ \

What is TST? You can do this:

-gltLabel 1 ‘CondtionA-ConditionB’ -gltCode 1 'Condition : 1A -1B Training : ’ \

Hi Gang,

Thanks so much. It works. I got following sub-bricks as the output.

#1 Training
#2 Condition
#3 Training:Condition
#4 A-B
#5 A-B t

As it is my first time to use this, I am a little bit confused to interpret the results. Is ‘A-B t’ the result of the difference (t-test) between Condition ATraining and Condition BTraining?

Also, there was significantly greater activation in left middle temporal gyrus in Condition ATraining - Condition BTraining, for example, how can I interpret this result? I am confused because Training is a continuous variable.

Thank you,

If sub-bricks #4 and #5 correspond to the following specification

-gltLabel 1 ‘CondtionA-ConditionB’ -gltCode 1 ‘TST : 1A Training : 1A -1*B’ \

then they show the difference of the training effect between condition A and B.