Statistics Toolbox    

Example: N-Way ANOVA with Small Data Set

Consider the following two-way example using anova2.

The factor information is implied by the shape of the matrix m and the number of measurements at each factor combination (2). Although anova2 does not actually require arrays of factor values, for illustrative purposes we could create them as follows.

The cfactor matrix shows that each column of m represents a different level of the column factor. The rfactor matrix shows that the top two rows of m represent one level of the row factor, and bottom two rows of m represent a second level of the row factor. In other words, each value m(i,j) represents an observation at column factor level cfactor(i,j) and row factor level rfactor(i,j).

To solve the above problem with anovan, we need to reshape the matrices m, cfactor, and rfactor to be vectors.


  N-Way Analysis of Variance Example: N-Way ANOVA with Large Data Set