IN.N_subs = [40];
IN.Between = [1]; %This will form your constant term.
IN.BetweenLabs = {{‘Constant’}};
IN.Covar = {X(:,1)};
IN.CovarLabs = {‘Age’};
IN.FactorLabs = {‘Const’ ‘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.RemoveOutliers=0;
I.Scans = {...
‘s01.nii’;
‘s02.nii’;
‘s03.nii’;
‘s04.nii’;
... };
% This contrast will give the stats for the correlation of image data with the covariate,
I.Cons(1).Groups = {2};
I.Cons(1).Levs = [1];
I.Cons(1).ET = 1;
I.Cons(1).mean = 0;
I = GLM_Flex(I);
IMPORTANT: The order of scans and the order of measurements in the covariate must match.
WIth the above model we could also do a one sample t-test after controlling for age. However if we wanted to do that then we should first demean our age covariate X(:,1)-mean(X(:,1). If we do not demean, then the mean of the group changes into the intercept for the regression model, which could end up just about anywhere depending on the covariate. By demeaning the covariate we control for variance without changing the group mean.
IN.N_subs = [40];
IN.Between = [1]; %This will form your constant term.
IN.BetweenLabs = {{‘Constant’}};
IN.Covar = {X(:,1) X(:,2) X(:,3)}; % Note that each covariate is put in separately - X(:,1:3) will not work correctly.
IN.CovarLabs = {‘Age’ ‘Education’ ‘IQ’};
IN.FactorLabs = {‘Const’ ‘Age’ ‘Education’ ‘IQ’};
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.RemoveOutliers=0;
I.Scans = {...
‘s01.nii’;
‘s02.nii’;
‘s03.nii’;
‘s04.nii’;
... };
% Test for relationship with Age while controlling for Education and IQ
I.Cons(1).name = ‘AgeCorr’;
I.Cons(1).Groups = {2};
I.Cons(1).Levs = [1];
I.Cons(1).ET = 1;
I.Cons(1).mean = 0;
% Look at what the full regression Model Predicts
I.Cons(2).name = ‘Full_Model’;
I.Cons(2).Groups = {2 3 4};
I.Cons(2).Levs = [0];
I.Cons(2).ET = 1;
I.Cons(2).mean = 0;
% Look at combined relation of education and IQ controlling for Age
I.Cons(2).name = ‘Full_Model’;
I.Cons(2).Groups = {3 4};
I.Cons(2).Levs = [0];
I.Cons(2).ET = 1;
I.Cons(2).mean = 0;
I = GLM_Flex(I);