Why degrees of freedom is not correctly represented in repeated measure ANOVA (ranova) table?

4 ビュー (過去 30 日間)
Hello,
I am trying to do a repeated measure ANOVA using the ranova command in 2014 Matlab. I am trying to compare activity of a number of cells (lets say 60, as random variables) across 2 different conditions through 21 epochs of time. Here is how I define my table:
Epoch=[(1:21)';(1:21)'];
Task(1:21,1)=['A'];
Task(22:42,1)=['B'];
Task_Epoch=table(Task,Epoch);
cellnum=[1:60]';
RespTable = table(cellnum,Pref_act_Epoch(1,:)',Pref_act_Epoch(2,:)',Pref_act_Epoch(3,:)',Pref_act_Epoch(4,:)',Pref_act_Epoch(5,:)',Pref_act_Epoch(6,:)',Pref_act_Epoch(7,:)',Pref_act_Epoch(8,:)',Pref_act_Epoch(9,:)',Pref_act_Epoch(10,:)',Pref_act_Epoch(11,:)',Pref_act_Epoch(12,:)',Pref_act_Epoch(13,:)',Pref_act_Epoch(14,:)',Pref_act_Epoch(15,:)',Pref_act_Epoch(16,:)',Pref_act_Epoch(17,:)',Pref_act_Epoch(18,:)',Pref_act_Epoch(19,:)',Pref_act_Epoch(20,:)',Pref_act_Epoch(21,:)',Pref_actPID_Epoch(1,:)',Pref_actPID_Epoch(2,:)',Pref_actPID_Epoch(3,:)',Pref_actPID_Epoch(4,:)',Pref_actPID_Epoch(5,:)',Pref_actPID_Epoch(6,:)',Pref_actPID_Epoch(7,:)',Pref_actPID_Epoch(8,:)',Pref_actPID_Epoch(9,:)',Pref_actPID_Epoch(10,:)',Pref_actPID_Epoch(11,:)',Pref_actPID_Epoch(12,:)',Pref_actPID_Epoch(13,:)',Pref_actPID_Epoch(14,:)',Pref_actPID_Epoch(15,:)',Pref_actPID_Epoch(16,:)',Pref_actPID_Epoch(17,:)',Pref_actPID_Epoch(18,:)',Pref_actPID_Epoch(19,:)',Pref_actPID_Epoch(20,:)',Pref_actPID_Epoch(21,:)');
R1 = fitrm(RespTable,'Var2-Var43~cellnum','WithinDesign',Task_Epoch);
ranovatbl =ranova(R1,'WithinModel','Task+Epoch+Task*Epoch');
The RespTable looks exactly as it should and the ranova table looks reasonable too, however, the df is always 1 whether it is looking at the task, or epoch or even their interception. Anybody knows why and what I am doing wrong?
P.S. Is there any more civilized way of filling the Resptable rather than naming all the 42 epochs one by one?
Regards, Mohsen

採用された回答

Sophia Snipes
Sophia Snipes 2021 年 8 月 13 日
Hello Mohsen,
I know this is way too late for you, but I found your question because I had the same one, and was eventually able to find the answer, at least to my problem.
For the within-design table, MATLAB treats the values differently if it's numerical or categorical. so in your case, before inserting "Epoch" into the Task_Epoch table, you have to make it categorical first:
Epoch = categorical(Epoch);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRepeated Measures and MANOVA についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by