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’};

IN.EqualVar = [1];

IN.Independent = [1];

F = CreateDesign(IN);

figure(20); clf

imagesc(F.XX); colormap(gray); shg

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.Cons(1).mean = 0;

I = GLM_Flex(I);

That’s it, that’s an ANCOVA.

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.


Home        GLM Flex        FIVE        Downloads    Batch Scripts        News Feed