From MR Tools
Jump to: navigation, search

Remember that for an ANOVA we are primarily interested in group differences after controlling for one or more continuous variables, this means that you should always demean the covariates in an ANCOVA analysis.

IN.N_subs = [20 20];  
IN.Between = [2];       
IN.BetweenLabs = { {‘Group1’ ‘Group2’} };
IN.Covar = {X(:,1)-mean(X(:,1))};
IN.CovarLabs = {‘Age’};
IN.FactorLabs = {‘Group’ ‘Age’};

F = CreateDesign2(IN); 

I.OutputDir = pwd;
I.F = F;
I.minN = 5;
I.DoOnlyAll = 1;
I.Scans = {...

%Test the difference between the groups after controlling for Age
I.Cons(1).Groups = {1 2};
I.Cons(1).Levs = [2];  
I.Cons(1).ET = 1;

I = GLM_Flex2(I);

Things can get tricky when you have reason to believe that the effect is different in different groups. For instance if you model the fit independently for each group, then you should probably demean the covariate independently for each group.

Personal tools