MATLAB Answers


Is it possible to perform analysis of variance with random effects or repeated measures using the Statistics Toolbox?

ANOVA2 performs 2 factor analysis of variance, but this is with 2 fixed measures. I would like to know if there is any way to perform analysis of variance with random effects, nested effects, or repeated measures.


No tags entered yet.

1 Answer

Answer by MathWorks Support Team on 4 Jan 2017
 Accepted Answer

The ANOVA1 and ANOVA2 functions perform fixed-effects analysis of variance (anova). ANOVA1 does one-way anova. ANOVA2 does two-way anova with perfectly balanced data; that is, each combination of the two factors must have the same number of measurements.
The ANOVAN function is more flexible. It can perform one-, two-, or higher-way anova that is not balanced. Also, you can specify factors as random effects. The ANOVAN function will then compute expected mean squares and use them to perform the appropriate F tests. It will also compute estimates of the variances of the random effect terms (sometimes called the components of variance) by equating the calculated mean squares to their expected values, and solving for the variances.
The capability to fit repeated measures models has been introduce in release R2014a.

  1 Comment

Sorry to comment with a question, but I wondering if it's possible to estimate the variance between workers and between days (within worker) extracting the variance component of the one-way anovan.
Thanks in advance, Luiz

Sign in to comment.