Mixed anova design function (unbalanced design)
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I am trying to run a mixed (between and within design) anova and it seems like matlab does not have the function for that. I used the code as provided here (https://www.mathworks.com/matlabcentral/fileexchange/27080-mixed-between-within-subjects-anova) but it is not able to run with an unbalanced design i.e the within subject factor in my dataset has varying levels, but the code only runs it when it has same levels.
Is there a function out there that anyone may direct me to, to solve this issue?
Would be very grateful, thank you!
3 commentaires
Adam Danz
le 30 Déc 2020
This answer demonstrates the workflow for a repeated measures ANOVA
and a review of assumptions and how to interpret the results
Réponse acceptée
Adam Danz
le 31 Déc 2020
Modifié(e) : Adam Danz
le 31 Déc 2020
Disclaimer: I'm not an expert in statistical test selection and have met very few experts on this matter. Test selection should always consider the assumptions, the null hypothesis, and whether or not your experimental methods are appropriate for the test.
From what I undersand you have a categorical independent variable, More|Less light exposure, where each level was applied to different groups of people. You have a continuous independent variable, hours of sleep during pre-expt, that potentially differs between all subjects. And you have dependent variable you're measuring which you didn't mentioned, perhaps something like serotonin or melatonin levels. You want to make sure the hours of sleep hasn't significantly affected the outcome of the DV.
A ANCOVA analysis will answer this question. An ANCOVA evaluates whether the means of the DV are equal across levels of the categorical IV (More|Less light) while controlling for the effects of a continuous covariate sometimes called a nuisance variable [wiki].
Note that a general linear model (GLM) is the same mathematical model as an ANCOVA (see Karen Grace-Martin's concise comparison).
Recommended sources on ANCOVA & GLM
- Bingham & Fry (2010). Regression: Linear models in statistics. Chapter 5.2
- Freund, Wilson, & Sa (2006). Regression Analysis Statistical Modeling of a Response Variable. Chapter 9.6
- Brandon Foltz's excellent tutorial on ANCOVA [youtube].
- Quantitative methods in Neuroscience, Chapter 9 (on GLM) [available online]
Matlab tools & Community resources
- Documentation: ANCOVA Demo using aoctool.
- Documentation: aoctool()
- Answers forum: anovan() as an alternative to aoctool (see here and here and here).
- Documentation: anovan()
- Documentation: GLM Demo using fitglm.
- Documentation: GLM Workflow
- Documentation: fltglm()
----------------------------------------------------------------
Old answer:
There's not enough information about your design to understand if a rmANOVA, 2-way ANOVA, ANCOVA, or a general linear model would be suitable. More importantly, that choice relies on the question you're asking which is also unclear.
If you can briefly describe your design and the question you're asking, I could help further and will update this answer. In the meantime, here are some general resource provided by Matlab on linear mixed-effects models.
4 commentaires
Ive J
le 1 Jan 2021
Modifié(e) : Ive J
le 1 Jan 2021
Based on what you already explained, you have a repeatedly measured IV (and single DV). Just note that in this scenario (GLM) you miss the structure of sleeping hours (as you already mentioned, you are interested in day-to-day variation). So you're reducing your model to
fitlm(data, 'response ~ sleeping_hrs + light_exposure')
This essentially means you are collapsing the sleeping hours matrix into a single vector (you may consider the matrix as a covariate but I'm not sure if this doesn't violate the independence assumption among IVs):
sleeping_hrs = sum(sleeping_hrs_mat, 2); % assuming no NaN values
You may also want to take a look at the discussion over a similar question here. So, you could use a latent growth curve model first, and use the outcome as a new IV for your response. However, everything here depends on your research questions.
Plus de réponses (1)
Jeff Miller
le 31 Déc 2020
If the goal of the analysis is to see if the two groups differ significantly in sleep pre-expt, then actually the simplest appropriate analysis is to (a) compute the average sleep for each subject over the preceding 9 or 10 days, and then (b) do a between-groups t-test on these 200 averages.
You could also analyze these averages as the DV in a 2-group ANCOVA with any possible covariates that you wanted to adjust for.
It may seem unintuitive that the day-to-day variation within each subject can be ignored using these across-day averages, but that is actually the case in an ANOVA with both between- and within-Ss factors.
Voir également
Catégories
En savoir plus sur ANOVA dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!