How to preform Anova + Tukey for within-subject design
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hey all, I am trying to write a code to analyze my experiment results:
My experiment is a within-subject design,each subject (1-5) has done the test at 8 different levels (NL_0,NL_1,TH_450...SH_1350).
The "df.csv" attached describe my results, after transforming the data for within-subject analysis I got "testDf.csv" (might not be needed at all...).
First I want to perform an ANOVA test, and afterward, I want to perform a Tukey test to compare all the levels combinations.
If it was a between-subject design i would use:
df = readtable('df.csv')
[p,tbl,stats] = anova1(df.y,df.trialName)
confidanceLevel = 0.05;
[c,m,h,gnames] = multcompare(stats,'Alpha',confidanceLevel);
After reading some questions at the forum, I figured that I need to use something more like this one:
testDf = readtable('testDf.csv')
measurements = table([1 2 3 4 5 6 7 8]','VariableNames',{'Measurements'});
rm = fitrm(testDf,"NL_0,NL_1,SH_1350,SH_450,SH_900,TH_1350,TH_450,TH_900~Subject"...
,'WithinDesign',measurements);
ranovatbl = ranova(rm)
tbl = multcompare(rm,'NL_0')
The multicompare doesn't work, and I think I have done something wrong in the process of getting there...
I would really appreciate your help.
Thanks,
Itay
0 Commenti
Risposte (1)
Scott MacKenzie
il 9 Feb 2022
Modificato: Scott MacKenzie
il 9 Feb 2022
I believe the issue is you've incorrectly specified the variable as the second argument in multcompare. Try
tbl = multcompare(rm, 'Measurements')
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!