Error when running a repeated measures ANOVA
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
pablo dopico
am 23 Nov. 2020
Kommentiert: pablo dopico
am 24 Nov. 2020
Hello, I need to run a repeated measure ANOVA with three independent factors, but I'm struggling to make my code work even with just one factor.
Below is my code.
words is a matrix with columns corresponding to patient IDs (integers 1-205). Vowel, Treatment, and Test are all factors, but are replaced with a number (ex. Test can take the value 1, 2, or 3). Test is the repeated measure "time" variable. MD is the dependent outcome variable.
I tried running my ANOVA without including other factors at first, following along with other examples, I've seen. I keep getting the error:
"Error using RepeatedMeasuresModel/set.WithinDesign (line 1235) Specified design has 3 points; 1 required. "
I guess I don't understand the role of WithinDesign very well. Could someone help me out a bit?
Thank you!
words = array2table(words);
stories = array2table(stories);
words.Properties.VariableNames(1:5) = {'ID','Vowel','Treatment','Test','MD'};
withinDsgn = table((1:3)','VariableNames',{'Test'});
wordsrm = fitrm(words, 'MD~ID*Test', 'WithinDesign', withinDsgn);
0 Kommentare
Akzeptierte Antwort
Jeff Miller
am 23 Nov. 2020
I'm pretty sure fitrm expects all of the data from a single patient to be on one row of the input data table (e.g., words)--at least by default, maybe there is some way around this. So, for your example with 3 tests, it would expect 3 separate columns of data, say Test1, Test2, Test3, and a command like
wordsrm = fitrm(words,'Test1-Test3 ~ ID','WithinDesign', withinDsgn)
Your fitrm command only specified one score (MD), so fitrm thought the WithinDesign 'required' only one condition per patient, and it was confused because your WithinDesign specifies 3 conditions.
Additional repeated measures factors would multiply the number of columns to the left of the '~' in the model statement.
3 Kommentare
Jeff Miller
am 24 Nov. 2020
Right. And you need to specify that the variables of WithinDesign are categorical. The example here may help.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Repeated Measures and MANOVA finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!