How can i understand the within and between model factors of a mixed model ANOVA
Mostra commenti meno recenti
Hi everyone,
I am trying to run a mixed model ANOVA and struggle to define the within and between subject terms of the fitrm function.
Data description:
Lets say I have temerature data from 3 timepoints (10min, 30min and 60min) and three locations (left ear, right ear, forehead), additionally I have two groups (1,0) where group 1 gets a treatment and group 0 not. I want to run a mixed model ANOVA to see whether or not there are effects over time, i.e. does the temperature decrease, increase or stay the same. Simultaneously I want to see whether this is dependant on the group, i.e. does it matter if I am getting the treatment as well as the location that the measurement comes from, i.e. does it matter where am I measuring. In my heaad a mixed model ANOVA was teh right way to do so. I have created a dataset that should replicate the type of data I have and attached the file.
I have troubles wrapping my head around the within and between factors and how to specify them. At the moment my model runs with this specification:
withinFactors = 1:3; % 1,2,3 for Meas1, Meas2 and Meas3
% Define the model formula
modelFormula = 'Meas1-Meas3 ~ Group:Location';
% Fit mixed-design ANOVA model
rmModel = fitrm(data_tbl, modelFormula, 'WithinDesign', withinFactors);
And I get a decent output with it. However my struggel is that I would like to have the Location Variable as a withinFactor and I do not know how to handle this, at least it does not appear very intuitively. I have tried to understand the matlab examples where two withinfactors are supplied, but I simply cannot transfer it to my code since I do not understand what going on. Any help would be much appreciated.
I hope the data supplied is sufficient, if you need anything else, pleas elet me know.
2 Commenti
Jeff Miller
il 19 Apr 2024
I don't understand how the data_tbl created by your attached script matches up with the design you describe. For example, the different locations appear in different rows of data_tbl, which makes it look like location is a between factor rather than a within factor.
From your data description I was expecting 9 data points per row of data_tbl (3 time points x 3 locations, both within), with one row per subject (different rows labelled 1 or 0 to indicate group).
Julian Ostertag
il 19 Apr 2024
Modificato: Julian Ostertag
il 19 Apr 2024
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Analysis of Variance and Covariance in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!