How to test for a main effect of the between subjects-variable with fitrm and ranova?
    7 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
I am using fitrm to do a two-way repeated measures ANOVA on EEG data from children. The within-subject (repated measures) variable is sleep (i.e., whether the child is awake or asleep during the EEG), and the between-subject variable is group (whether the child is in a clinical group or a healthy control group). I want to test for main effects of both sleep and group on my EEG measure, and also a group x sleep interaction. Obviously, I need to run a repeated-measures model, given that sleep is a within-subject measure. But, I also want to test for a main effect of my between subjects measure (group), and that is what I am having difficulty returning. 
Right now, my code looks like this,
rm = fitrm(T_mse,'Awake-Asleep ~ Group','WithinDesign',Sleep);
ranovatbl = ranova(rm)
where T_mse is a 3-column table containing the EEG measure of interest, in which the first column (Group) contains the coded group labels (0 or 1), the second column (Awake) contains the EEG values for the awake condition, and the third column (Asleep) contains the EEG values for the asleep condition. So, I call fitrm and then plug the output into ranova to get a table with the following rows: (Intercept):Sleep, Group:Sleep, Error(Sleep). Ok great, now I have the main effect of Sleep and the Sleep x Group interaction, but, I also want to look for a main effect of Group. Can I do this without calling a separate function? Of course, if I call anovan, I can get the main effects of Group and Sleep and their interaction, but then this completely disregards the fact that Sleep is within-subject. To make my code more efficient, I'd prefer to just get everything by calling fitrm and ranova, is this possible? 
0 Kommentare
Antworten (1)
  Jeff Miller
      
 am 30 Mai 2020
        % Define the within-Ss factor and give it a name.  The 1 & 2 refer to Awake / Asleep
WithinStructure = table([1 2]','VariableNames',{'Sleep'});
% Tell fitrm about the within design & factor
rm = fitrm(datatable, 'Awake-Asleep ~ Group','WithinDesign',WithinStructure,'WithinModel','Sleep');
% Specify the repeated-measure factor again when you call ranova:
ranovatable = ranova(rm,'WithinModel','Sleep');
1 Kommentar
  Antonios Nasioulas
 am 28 Mai 2024
				
      Bearbeitet: Antonios Nasioulas
 am 28 Mai 2024
  
			Hello,
I tried this and I think I get something weird.
When I use the 'WithinModel' to obtain the main effect of the between-subjects variable, the main effect of the within-subjects variable comes up highly singificant 
                                SumSq      DF       MeanSq          F         pValue     pValueGG       pValueHF    pValueLB
(Intercept):withinFactor        4.5804     1        4.5804          149    1.7821e-18    1.7821e-18    1.7821e-18    1.7821e-18
but when I omit the 'WithinModel',the within-subbjects factor is nowhere near to be significant
(Intercept):withinFactor     0.0044581     1       0.0044581       0.25847     0.6129     0.6129      0.6129      0.6129 
How is this possible?
Also, if I run completely independently a paired test for the two levels of the withinFactor, again it is far from being significant.
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!