Main Content

Analysis of Variance and Covariance

Parametric and nonparametric analysis of variance, interactive and noninteractive analysis of covariance, multiple comparisons

Analysis of variance (ANOVA) is a procedure for assigning sample variance to different sources and deciding whether the variation arises within or among different population groups. Samples are described in terms of variation around group means and variation of group means around an overall mean. If variations within groups are small relative to variations between groups, a difference in group means may be inferred. Hypothesis tests are used to quantify decisions. Statistics and Machine Learning Toolbox™ offers several ways to perform ANOVA, including an anova object, command line functions, and an interactive app.


expand all

anovaAnalysis of variance (ANOVA) results (Since R2022b)
boxchartBox chart (box plot) for analysis of variance (ANOVA) (Since R2022b)
groupmeansMean response estimates for analysis of variance (ANOVA) (Since R2022b)
multcompareMultiple comparison of means for analysis of variance (ANOVA) (Since R2022b)
plotComparisonsInteractive plot of multiple comparisons of means for analysis of variance (ANOVA) (Since R2022b)
statsAnalysis of variance (ANOVA) table (Since R2022b)
varianceComponentVariance component estimates for analysis of variance (ANOVA) (Since R2022b)
anova1One-way analysis of variance
anova2Two-way analysis of variance
anovanN-way analysis of variance
canoncorrCanonical correlation
dummyvarCreate dummy variables
friedmanFriedman’s test
kruskalwallisKruskal-Wallis test
multcompareMultiple comparison test
aoctoolInteractive analysis of covariance


  • One-Way ANOVA

    Use one-way ANOVA to determine whether data from several groups (levels) of a single factor have a common mean.

  • Two-Way ANOVA

    In two-way ANOVA, the effects of two factors on a response variable are of interest.

  • N-Way ANOVA

    In N-way ANOVA, the effects of N factors on a response variable are of interest.

  • ANOVA with Random Effects

    ANOVA with random effects is used where a factor's levels represent a random selection from a larger (infinite) set of possible levels.

  • Other ANOVA Models

    N-way ANOVA can also be used when factors are nested, or when some factors are to be treated as continuous variables.

  • Multiple Comparisons

    Multiple comparison procedures can accurately determine the significance of differences between multiple group means.

  • Analysis of Covariance

    Analysis of covariance is a technique for analyzing grouped data having a response (y, the variable to be predicted) and a predictor (x, the variable used to do the prediction).

  • Nonparametric Methods

    Statistics and Machine Learning Toolbox functions include nonparametric versions of one-way and two-way analysis of variance.