Possible bug with 3-way repeated measures ANOVA [BUG]
Closed this issue · 6 comments
Hi!
I had the impression that LIMO allows to do a n-way Rep. Measures ANOVA, i.e. from here: https://github.com/LIMO-EEG-Toolbox/limo_tools/wiki/Repeated-Measure-ANOVA from the multiple factors paragraph.
However either from the GUI or from the script it seems only working with 2 factors.
- In GUI when I enter [2 2 2] factor structure (which in my understanding should correspond to 3 factors having 2 levels each), I'm getting "the number of parameter chosen (6) does not match the total number of levels (8)" message, coming from:
if size(parameters,2) ~= prod(factor_nb)
warning(['the number of parameter chosen (',num2str(size(parameters,2)), ...
') does not match the total number of levels (',num2str(prod(factor_nb)),')'])
return
end
prod of factor_nb calculation seem to work well with 2 factorial designs, but not with 3 factors. At least the sum of factor levels is 6, not 8, as the params.
- In the script,
imo_random_select('Repeated Measures ANOVA',chanlocs,'LIMOfiles',...
fullfile(STUDY.filepath,['derivatives/LIMO_study1'],'Beta_files_study1_design1_GLM_Channels_Time_WLS.txt'),...
'analysis_type','Full scalp analysis','parameters',{[1 2],[4 3],[6 5]},...
'factor names',{'awareness','attention','responding'},'type','Channels','nboot',10,'tfce',0,'skip design check','no');
these {[1 2],[4 3],[6 5]}
parameters still result in as if it were 2 factors, by
function levels = getlevels(params)
% drill-down the cell array of repeated measures parameters
if ~iscell(params)
levels = length(params);
if levels == 1
levels = [];
end
else
levels = [length(params) getlevels(params{1}) ];
end
this function and cause a warning message
if length(LIMO.design.factor_names) ~= length(factor_nb)
warning('factor names (n=%g) removed as it does not match number of factors entered (n=%g)',length(LIMO.design.factor_names),length(factor_nb));
LIMO.design = rmfield(LIMO.design,'factor_names');
end
Or perhaps I am doing it wrong. I have 3 factors with 2 levels (trial types) in each. I would very much need this functionality for my research. Please let me know if it's doable with LIMO or maybe I'm doing it wrong.
Thank you in advance!
what's your experimental manipulation? 3 factors of two is 2x2x2 that's 8 parameters, it is always prod(factor_nb)
or you collected 6 conditions but it is not full factorial (which is 8)
{[1 2],[4 3],[6 5]}
is two factors
factor 1 is 12 vs 43 vs 65
factor 2 is 146 vs 235
In the experiment I have awareness (aware, unaware), attention (target, nontarget) and responding (response, noresponse) factors.
However since my trials have overlapping conditions, something like "nogo target aware responded", "go nontarget aware" etc, I extracted aware/unaware trials for awareness factor, trials with targets/nontargets for attention and response/noresponse for responding; generating 3 new trials out of 1 and then concatenating them. I also used the EEGLAB STUDY design, having 3 variables: type (aware - unaware), type (nontarget - target), type (noresponse - response). Perhaps I could do it other way?
In my parameter list from the GUI I also got 7th and 8th params called Constant, but selecting all of them or 7 resulted in another error
so you get my point that awareness (aware, unaware), attention (target, nontarget) and responding (response, noresponse) factors is 8 conditions not six -- the issue is indeed how you specify stuff at the 1st level (constant is just the subject-specific mean ie your random effect)
what you should do is create a 1st level design with the 8 conditions (ie 9 columns since the last one is the constant term) then you can do the 2nd level as 2 by 2 by 2. In the STUDY GUI selecting multiple factors and click 'combine' can do that for you.
Thank you for clarifying that out, 8 conditions then.
I am still, however, confused with which 2 additional conditions should I add: 1-aware, 2-unaware, ... 6-noresponse, 7 and 8 might be interactions, i.e. awareness x attention and awareness x responding? Probably it's not the case, the interactions are probably calculated automatically as in ANOVAs in general and also how about a 3-way interaction then
there is no factor and no interaction at the subject level, you simply code the 8 conditions (like you would if you would compute mean reaction times)
aware target response
aware target nonresponse
aware nontarget response
aware nontarget nonresponse
unaware target response
unaware target nonresponse
unaware nontarget response
unaware nontarget nonresponse
at the group level, you code factors -- see https://github.com/LIMO-EEG-Toolbox/limo_tools/wiki/Repeated-Measure-ANOVA