How to perform 2-way repeated-measures Manova using RepeatedMeasuresModel?
6 views (last 30 days)
Show older comments
Hi,
I'm currently stuck on performing a two-way repeated-measures Manova in Matlab using the RepeatedMeasuresModel. My data set consists of six units, from each of which I measured three properties, which might be highly correlated. Each unit was tested using two within-subject factors each of which has two levels (4 conditions in total). Thus, my data table consists of six rows and twelve columns (3 properties * 4 conditions).
I created the within-table as follows:
within = table({'A';'A';'A';'A';'B';'B';'B';'B';'C';'C';'C';'C'},...
{'1';'2';'1';'2';'1';'2';'1';'2';'1';'2';'1';'2'},...
{'a';'a';'b';'b';'a';'a';'b';'b';'a';'a';'b';'b'},...
'VariableNames',{'Property','Condition1','Condition2'});
The table looks like:
Property Condition1 Condition2
________ __________ __________
'A' '1' 'a'
'A' '2' 'a'
'A' '1' 'b'
'A' '2' 'b'
'B' '1' 'a'
'B' '2' 'a'
'B' '1' 'b'
'B' '2' 'b'
'C' '1' 'a'
'C' '2' 'a'
'C' '1' 'b'
'C' '2' 'b'
The repeated-measures Model I created using
rm = fitrm(t,'M1-M12~1','withinDesign',within);
where t is the data table and M1-M12 are the responses.
If I now use
manova(rm)
the output looks like this:
Statistic Value F RSquare df1 df2 pValue
_________ _______ ___ _______ ___ ___ ______
Pillai 0.54237 0 0.54237 6 0 NaN
Wilks NaN NaN NaN 6 0 NaN
Hotelling NaN NaN NaN 6 NaN NaN
Roy Inf NaN NaN 6 0 NaN
I don't know, how I can specify, which of my within-subject factors are the different properties and which ones are the different conditions.
Help of any kind would be highly appreciated.
Best, Christian
0 Comments
Answers (1)
Aditya
on 8 Feb 2025
Hi Christian,
To perform a two-way repeated-measures MANOVA in MATLAB using the RepeatedMeasuresModel, you need to ensure that your within-subject factors and response variables are correctly specified. It seems like the issue might be with how the within-subject factors are defined and how the fitrm function is being used.
Here is an example code:
within = table({'A'; 'A'; 'A'; 'A'; 'B'; 'B'; 'B'; 'B'; 'C'; 'C'; 'C'; 'C'}, ...
{'1'; '2'; '1'; '2'; '1'; '2'; '1'; '2'; '1'; '2'; '1'; '2'}, ...
{'a'; 'a'; 'b'; 'b'; 'a'; 'a'; 'b'; 'b'; 'a'; 'a'; 'b'; 'b'}, ...
'VariableNames', {'Property', 'Condition1', 'Condition2'});
% Assume your data table t is structured with columns M1 to M12
rm = fitrm(t, 'M1-M12 ~ 1', 'WithinDesign', within);
manovaResults = manova(rm);
disp(manovaResults);
0 Comments
See Also
Categories
Find more on Repeated Measures and MANOVA in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!