MATLAB: How to setup a Repeated Measurements. model and then perform a Manova

doefull factorial doemanovaMATLABrepeated measures

Hi there,
I'm trying to perform a Manova analysis using the corresponding Repeated Measurements model, or at least that is what I think is the right aproach.
My data comes from a Full-Factorial DOE with 3 factors, 2 levels each plus a control group (no-treatment whatsoever). I also have multiple replicates in each experimental group so each group has different sample-size since subjects were asigned randomly to any of the experimental groups, 9 in total (2^3 + 1), and four different measurements were recorded for each subject. These measurements are highly correlated.
Attached is a sample of the data containing:
  • Subject's ID
  • Subject's Experimental Group
  • Factor 1 to 3 (coded "1" or "-1")
  • Factor 1 to 3 real level's values
  • P 1 to 4 –> Measurements
Hope anyone could point me in the right direction to setup the model parameters and the manova. Thanks!!
Regards,
Juan

Best Answer

tbl = readtable("libro6.xlsx");
% Remove control group
control = tbl.Exp_Group == 9;
tbl(control,:) = [];
% Define & fit repeated measures model,
% almost the same as fisheriris at
% https://www.mathworks.com/help/stats/repeatedmeasuresmodel.manova.html
Meas = table([1 2 3 4]','VariableNames',{'Measurements'});
rm = fitrm(tbl,'P1-P4~Factor1*Factor2*Factor3','WithinDesign',Meas);
% manova calculations
man = manova(rm)