tramarobin / fctSnPM

Using spm1d package (v.0.4.3), compute anova and post-hoc tests from anova1 to anova3rm, with a non-parametric approach (permutation tests)
GNU General Public License v3.0
4 stars 2 forks source link

One-way ANOVA and two-way ANOVA post hoc design #11

Closed jinhee615 closed 3 years ago

jinhee615 commented 3 years ago

Hello. I have some questions about post-hoc designs.

First, I made a Comparison of 3 Different group's gait patterns. Group A(n=15), B(n=20), C(n=14). All dataset is Y, and Each Group's Data is called YA, YB, YC each.

So I made a One-way ANOVA code with SPM Like

spm=spm1d.stats.anova1(Y, subj) and if there is a significant difference with those three Groups.

posthoc1=spm1d.stats.ttest2(YA,YB) posthoc2=spm1d.stats.ttest2(YB,YC) posthoc3=spm1d.stats.ttest2(YA,YC)

posthoc1i=posthoc1.inference(0.05) posthoc2i=posthoc2.inference(0.05) posthoc3i=posthoc3.inference(0.05)

I made a code like above to run post hoc.

ttest2 is appropriate for one way anova post-hoc? or ttest would be fit more? if latter one is better, may I ask how to build code? (I couldn't understand when I refered example.)

Second, In case of above, there were no repeated measure, So I tried to made a t-test post hoc. (not a paired t test)

If I use fctSPM, D1_independatnTtest would be appropriate for those design? or D1_ANOVA1rm would be fit more? But I'm worrying about My Experiment design is not a repeated measure. Or, D2_ANOVA1 is better one? If it is so, What's difference between D1 and D2?

Third, I have a 3 Groups x 3 Conditions experiment, two-way ANOVA design. Group D, E, F and number of patients are the same (n=12).

If it's not a repeated measure, Which post-hoc code would be suitable?

Thanks in advance.

tramarobin commented 3 years ago

Hi @jinhee615 ,

ttest2 is appropriate for one way anova post-hoc? or ttest would be fit more? if latter one is better, may I ask how to build code? (I couldn't understand when I refered example.)

As there is no repeated measures ttest is the one you should use.

If I use fctSPM, D1_independatnTtest would be appropriate for those design? or D1_ANOVA1rm would be fit more? But I'm worrying about My Experiment design is not a repeated measure. Or, D2_ANOVA1 is better one?

I will use D1_independantTtest.m. you need to change the line line 15 independantEffects{1}= with the names of your 3 effects ('A', 'B' or 'C'). The function will automatically adapt and perform a one-way ANOVA and 3 independent t-tests (ttest function)

If it is so, What's difference between D1 and D2?

The D2 scripts are made to perform 2-dimensinal analysis. Thought the function adapts itself to the input (a 1-dimensional analysis is performed is you have 1D data), the main differences are in optional inputs for the different plots.

What you could use in this script is however how to enter the different groups in independantEffects{1}=

independantEffects{1}={'L','L','L','L','L','L','L','M','M','M','M','S','S','S','S'}; % same number than participants repeatedMeasuresEffects=[]; effectNames={'Group'}; % There are 15 subjects belonging to either groupe 'L', 'M' or 'S' % Subjects 1 to 7 are 'L', 8 to 11 are 'M', and 12 to 15 are 'S'

Third, I have a 3 Groups x 3 Conditions experiment, two-way ANOVA design. Group D, E, F and number of patients are the same (n=12).

It is a repeated measure design if the 12 participants performed 3 different protocols/conditions. I will use D1_ANOVA2_1rm as example. independantEffects{1}= will be the different groups for your subjects ('D','E','F') and repeatedMeasuresEffects{1}={'C1','C2','C3'}; will be your repeated measure effect for the conditions 1, 2 and 3. The function will perform a 2way ANOVA with one repeated measure. Groups will be compared with independent t-test and conditions with paired t-tests.

Hope it can help you.

jinhee615 commented 3 years ago

Thanks for your advice! and I build a code like below.

spm=spm1d.stats.anova1(Y,A); spmi = spm.inference(0.05);

independantEffects{1}={'I','I','I','I','I','I','I','I','I','I','I','I','N','N','N','N','N','N','N','N','N','N','N','N','O','O','O','O','O','O','O','O','O','O','O','O'}; repeatedMeasuresEffects=[]; % empty

savedir=[]; savedir2=[];

spmAnalysis2=fctSPMS(Y,independantEffects,repeatedMeasuresEffects,'effectsNames',effectNames);

image

There were error occured, it means : Brace indexing are not appropriate in this kind of variable.

How can I try to change my code?

tramarobin commented 3 years ago

I think the variable Y is a matrix and not a structure as it seems to work with spm=spm1d.stats.anova1(Y,A).

fctSPM was originally thought for 2D analysis an the data must be in a structure

On way to do so is :

for i=1:size(Y,1) data{i}=Y(i,:)'; end

jinhee615 commented 3 years ago

Thanks! I learned one more. But another error occured : Comp is not a recognized function or variable. image

Should I add another variable?

tramarobin commented 3 years ago

This one is weird... First, I don't understand why it is displayed "no ANOVA required" while ANOVA1 is required.

is DATA a column or row structure ?

for i=1:size(Y,1)
data{i}=Y(i,:)';
end

gives a row structure while a column structure is needed, my bad. Try with :

for i=1:size(Y,1)
data{i,1}=Y(i,:)';
end
jinhee615 commented 3 years ago

It works :) Thanks!! and two more questions! How can I plot it, and How can I see Clusters?

In spm1d.anova1, I plot it like below

spm=spm1d.stats.anova1(Y,subj); spmi=spm.inference(0.05); spmi.plot(); disp(spmi.clusters{1})

Can I observe similar plot and clusters in fctSPM?

tramarobin commented 3 years ago

You're welcome, glad it worked !

and two more questions! How can I plot it, and How can I see Clusters?

To plot the analysis use fctSPM instead of fctSPMS, once you have choosen or indicated a savedir, the analysis will be plotted and saved at the savedir location. You can also use saveNplot but this alternative is still in development so I won't suggest it right now.

You can find the clusters informations in the variable spmAnalysis or the file spmAnalysis.mat if you used fctSPM

However, clusterLocation and clusterP are created only in one dimension and are not corrected with the result of the ANOVA. The simpler way to interpret the results of the analysis is to look at the figures created at savedir location. Please have a look at https://github.com/tramarobin/fctSPM#figures

jinhee615 commented 3 years ago

Thanks a lot! I have further questions, So I ll open New Issue!