Mixed anova design function (unbalanced design)

14 visualizzazioni (ultimi 30 giorni)
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 Commenti
Cside
Cside il 31 Dic 2020
Modificato: Cside il 31 Dic 2020
Hi Ive & Adam,
Repeated measures wouldnt work in my case as I have a different population undergoing each level of my independent variable (no overlaps in subjects though). Repeated measures requires the same population undergoing through the different levels of the IV.
Please correct me if I am wrong

Accedi per commentare.

Risposta accettata

Adam Danz
Adam Danz il 31 Dic 2020
Modificato: Adam Danz il 31 Dic 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
----------------------------------------------------------------
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 Commenti
Cside
Cside il 1 Gen 2021
Thank you for the exceptional answer, and for directing me to these resources. I will peruse them.
All best
Ive J
Ive J il 1 Gen 2021
Modificato: Ive J il 1 Gen 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.

Accedi per commentare.

Più risposte (1)

Jeff Miller
Jeff Miller il 31 Dic 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.
  1 Commento
Cside
Cside il 1 Gen 2021
That is true, I would like to capture their day-to-day variation as well, and was refraining from ttest for that reason. missed that out for anova. Thank you Jeff!

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by