How to perform mixed ANOVA with random effects?

17 vues (au cours des 30 derniers jours)
Arthur Lefevre
Arthur Lefevre le 27 Mai 2022
Réponse apportée : Yash le 12 Jan 2024
Hi,
I have a simple question that became really complicated the further I looked :
I recorded calcium signals (fiber photometry) from rats performing different behavior (moving, rearing, grooming, ...). So each rat has many instances of each behavior, recorded over several 5 minutes sessions (sessions happened a few days appart).
My hypothesis is that some behaviors will evoke a calcium response, while others won't.
It looks like this when I average calcium responses from all rats to all events ("baseline" is the average signal 1 sec before the behavior event started, "response" is the average signal 1 sec after the behavior event started).
So baseline/response is a repeated factor where for each event, signal at time t is compared to signal at time t+1.
My first question is how to compare the different behaviors (vertical comparisons), are they a repeated or a between factor? They do come from the same recordings so it is repeated in that sense, but the data "dependency" is not the same as for baseline/response, because here I am comparing responses from within the same signal.
My idea is to perform an ANOVA with time (baseline/response) as a within factor, behavior (rearing, grooming, ...) as a between factor, and to add rat and session as two random factors.
My second question is how to do it with matlab.
Can I use ranova and put rat identity and session number as between factors? (This does not sound correct)
Can/How do I use anovan and somehow specify that one factor is repeated, one is between and other two are random?
Should I use fitlme or another function?
Thanks in advance!
  1 commentaire
Jeff Miller
Jeff Miller le 28 Mai 2022
The fact that all of the baseline values are 0 suggests that maybe your dependent measures are scored relative to this baseline, so the baseline was necessarily zero. If that was the case, I wouldn't consider there to be a baseline/response factor but just consider the response condition in isolation (since it is a priori normalized relative to baseline).
Unless you are expecting common effects of sessions across rats (e.g., something like a practice/experience effect) from being in the box, you can probably just ignore sessions and analyze the average across sessions for each rat/behaviour type. Yes, sessions are random, but if these are nested within rats rather than crossed with rats (i.e., no common effects), then including this random term in the analysis gains you nothing over just analyzing the averages.
In short, if I understand what you have done, I would use a one-factor repeated measures design with behaviour as the factor, rats as the random unit, and responses-relative-to-baseline as the dependent measure.

Connectez-vous pour commenter.

Réponses (1)

Yash
Yash le 12 Jan 2024
Hi Arthur,
To answer your questions, let's analyze the factors at hand:
1) Time: It is a repeated factor (also known as within-subjects)
2) Behavior: This is a complex factor. Each rat exhibits all the behaviors, and these behaviors within the same rat are being compared. Therefore, it can be considered as a repeated factor. However, it is not paired in the same way as the baseline/response comparison, as each behavior is not compared to itself at a different time point, but rather different behaviors are compared to each other. Refer here for more information on comparison of ANOVA terminologies: https://stats.stackexchange.com/questions/88158/anova-terminology-repeated-measures-vs-within-between-subjects#comment172346_88158
3) Rat: Each rat is a random factor.
4) Session: This is also a random factor.
A mixed-design ANOVA can be performed where the model might look like:
Calcium Response ~ Time * Behavior + (1|Rat) + (1|Session)
As pointed out in Jeff's comment, sessions can be ignored as a factor and the analysis can be done by averaging across sessions if you are not expecting common effects of sessions across rats. Refer here to this MATLAB Answer by MathWorks Support Team on performing ANOVA analysis using Statisitics Toolbox: https://www.mathworks.com/matlabcentral/answers/99151-is-it-possible-to-perform-analysis-of-variance-with-random-effects-or-repeated-measures-using-the-st?s_tid=answers_rc1-3_p3_Topic
I hope this helps!

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by