2x2 Fully Within ANOVA
IN.N_subs = [4]; % note the the subjects are entered by condition
IN.Within = [2 2]; % Two factors
IN.WithinLabs = {{‘Fac1Lev1’ ‘Fac1Lev2’} {‘Fac1Lev1’ ‘Fac1Lev2’}};
IN.Interactions = {[1 2]};
IN.FactorLabs = {‘Factor1’ ‘Factor2’};
IN.EqualVar = [0 0]; % Do variance corrections
IN.Independent = [0 0]; % Do independence correction
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.RemoveOutliers=0;
I.Scans = {...
‘s01_c11_c21.nii’;
‘s01_c11_c21.nii’;
‘s01_c11_c21.nii’;
‘s01_c11_c21.nii’;
‘s01_c11_c21.nii’;
‘s02_c11_c22.nii’;
‘s02_c11_c22.nii’;
‘s02_c11_c22.nii’;
‘s02_c11_c22.nii’;
‘s02_c11_c22.nii’;
‘s03_c12_c21.nii’;
‘s03_c12_c21.nii’;
‘s03_c12_c21.nii’;
‘s03_c12_c21.nii’;
‘s03_c12_c21.nii’;
‘s04_c12_c22.nii’;
‘s04_c12_c22.nii’;
‘s04_c12_c22.nii’;
‘s04_c12_c22.nii’;
‘s04_c12_c22.nii’;
};
Below are the standard contrasts for a 2x2 ANOVA. Other contrasts are possible.
I.Cons(1).Groups = {1 2};
I.Cons(1).Levs = [2];
I.Cons(1).ET = 2;
I.Cons(1).mean = 0;
I.Cons(2).Groups = {3 4};
I.Cons(2).Levs = [2];
I.Cons(2).ET = 3;
I.Cons(2).mean = 0;
I.Cons(3).Groups = {5 6 7 8};
I.Cons(3).Levs = [2 2];
I.Cons(3).ET = 4;
I.Cons(3).mean = 0;
I = GLM_Flex(I);
Notice that these contrasts are the same as the between subjects design except for the error terms. The scripts will automatically make the contrast vectors for you. Also note that the Factor by Subject interactions terms are included to allow for the creation of the partitioned error terms. For this model you will get 4 Error terms: 1. Between Subjects term (not needed in this instance, but included nonetheless). 2. The First Within Factor error term. 3. The second Within Factor Error Term, and 4. The Within Factors Interaction error term.
Again be sure that the order of input images matches the design matrix.