3x3 ANOVA

58 views
Skip to first unread message

Samantha Maltezos

unread,
Mar 8, 2020, 12:15:15 PM3/8/20
to Aaron's fMRI matlab tools.
Hello friends!

I'm having difficulty running the GLMflex_fast_4 script for a 3x3 ANOVA (3 groups x 3 times). It worked perfectly when I used it on a 3x3x2 ANOVA (3 groups x 3 times x 2 task difficulty levels), so I just modified this same script to get rid of the "dat.Difficulty" variable.

Matlab indicates the following: 

Matrix dimensions must agree.

Error in FactorCross (line 42)
        st = st.*input{ii}(:,counts(ii));

Error in ANOVA_APS (line 140)
            Effects{end+1} = FactorCross(Effects(i2));

Error in GLM_Flex_Fast4 (line 54)
    MOD = ANOVA_APS(I.Data,I.Model,[],0,1,1);
 
Here's what my script looks like:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Scans = dir_wfp('D:\CogCtrl\GLM_flex_2020\Nback\3x3mixed_2-1back\*.nii');

%%% Create a data structure to hold the variables
clear dat
dat.fn = [];
dat.Group = [];
dat.Time = [];
dat.SS = [];

%%% In this case all the information we need is contained in the file names, 
%%% so all we have to do is parse the file names, and store the information in the dat structure.
for ii = 1:numel(Scans)
    [a b c] = fileparts(lower(Scans{ii}));
    tmp = regexp(b,'_','split');
    
    dat.fn{ii,1} = Scans{ii};
    dat.Group{ii,1} = tmp{1};
    dat.SS{ii,1} = tmp{2};
    dat.Time{ii,1} = tmp{3};
end

% First 24 Subjects (72 images) are in Group1.  
% Next 20 subjects (60 images) are in Group2.
% Last 23 sujects (69 images) are in Group3.
dat.Group = cell(402,1);
dat.Group(1:72) = {'G1'};
dat.Group(73:132) = {'G2'};
dat.Group(133:end) = {'G3'};

%%% Now we set up I (same as before) only with new entries for data and for model.
%%% These two new entries obviate the need for the IN + CreateDesign2 step.
clear I;
I.Scans = dat.fn;
I.Model = 'Group*Time + random(SS|Time)';
I.Data = dat;
I.OutputDir = 'D:/CogCtrl/GLM_flex_2020/Nback/3x3mixed_2-1back_results';
I.RemoveOutliers = 0;
I.DoOnlyAll = 1;
I.estSmooth = 1;

GLM_Flex_Fast4(I);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Thank you to anyone who can help me!

Aaron Schultz

unread,
Mar 8, 2020, 2:09:43 PM3/8/20
to fmri_mat...@googlegroups.com
I’m guess it’s an issue with the data specification and/or it’s not a full factorial. Can you send the I structure and or the I.Data structure?

-Aaron

--
You received this message because you are subscribed to the Google Groups "Aaron's fMRI matlab tools." group.
To unsubscribe from this group and stop receiving emails from it, send an email to fmri_matlab_to...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fmri_matlab_tools/6543556a-601d-443d-9fa8-d121eadb5c34%40googlegroups.com.

Samantha Maltezos

unread,
Mar 8, 2020, 2:26:16 PM3/8/20
to Aaron's fMRI matlab tools.
I've attached the I structure.


On Sunday, March 8, 2020 at 2:09:43 PM UTC-4, Aaron Schultz wrote:
I’m guess it’s an issue with the data specification and/or it’s not a full factorial. Can you send the I structure and or the I.Data structure?

-Aaron
To unsubscribe from this group and stop receiving emails from it, send an email to fmri_mat...@googlegroups.com.
I.mat

Samantha Maltezos

unread,
Mar 8, 2020, 2:31:52 PM3/8/20
to Aaron's fMRI matlab tools.
I've figured out the problem.

This is wrong:
dat.Group = cell(402,1). It is supposed to be dat.Group = cell(201,1). I only have 201 files.

Thank you for your help! It works now.
Reply all
Reply to author
Forward
0 new messages