anova1, anova2, or ranova?
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a set of data. I have 1 dependant variable measured 3 times from 5 subjects. Each of the 3 measurements represents a different level (A, B, and C). Based on my understanding, I should use a repeated measures ANOVA because I have multiple measurements from each subject. However, I am unable to get any results. I have tried making each subject a different group, and treating all subjects as the same group. I tried a 1-way ANOVA, which to my understanding treats every measure as a different subject, which seems wrong. I tried a 2-way ANOVA where subjects are treated as an independant variable. Using multcompare after anova1 and anova2 give me unexpected results. Based on the data, it seems pretty evident that column 1 and column 3 should both be significantly different than column 2. However, only column 1 vs column 2 is significant. I am unsure if I am doing something wrong, or if there is a different statistical test I should be using. Any help would be greatly appreciated.
clear,clc
close all
DepVar=[101.053914979877,1.10267662721688,39.9882799952772;216.136311110424,1.25119134782814,70.1362721192365;26.5334559925966,1.54372037819131,81.1211148269482;231.177535625968,0.890020347986787,135.886529812943;140.395359593013,0.00626713939985805,37.2109788038507];
% 1-way ANOVA
[p1,tbl,stats1]=anova1(DepVar);
c1=multcompare(stats1);
% 2-way ANOVA
[p2,tbl2,stats2]=anova2(DepVar,1);
c2=multcompare(stats2);
% RM ANOVA
sub=table([1 2 3]','VariableNames',{'Treatment'});
subject1=['1'; '2'; '3'; '4'; '5'];
t1=table(subject1,DepVar(:,1),DepVar(:,2),DepVar(:,3),'VariableNames',{'subject','A','B','C'});
rm1=fitrm(t1,'A-C ~ subject','WithinDesign',sub);
ranovatbl1=ranova(rm1,'WithinModel','Treatment');
c3=multcompare(rm1,'Treatment');
subject2=['1'; '1'; '1'; '1'; '1'];
t2=table(subject2,DepVar(:,1),DepVar(:,2),DepVar(:,3),'VariableNames',{'subject','A','B','C'});
rm2=fitrm(t2,'A-C ~ subject','WithinDesign',sub);
ranovatbl2=ranova(rm2,'WithinModel','Treatment');
c4=multcompare(rm2,'Treatment');
16 commentaires
Adam Danz
le 29 Avr 2021
Yes, answers are often developed within comment sections as the question becomes clearer. When a definite solution arises, summarizing that solution or copying it to an official answer makes it more visible to future visitors of the thread whether its accepted or not and it gives users the opportunity to give you credit for your work by accepting or voting for your answer. Plus the thread moves into the answered pool rather than lingering in the unanswered queue.
Scott MacKenzie
le 29 Avr 2021
Modifié(e) : Scott MacKenzie
le 29 Avr 2021
OK, got it. Thanks for the clarification. I'll summary my comments into an answer and move them to an answer box. Cheers.
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!