Statistics Toolbox    
anova2

Two-way Analysis of Variance (ANOVA)

Syntax

Description

anova2(X,reps) performs a balanced two-way ANOVA for comparing the means of two or more columns and two or more rows of the observations in X. The data in different columns represent changes in factor A. The data in different rows represent changes in factor B. If there is more than one observation for each combination of factors, input reps indicates the number of replicates in each "cell," which much be constant. (For unbalanced designs, use anovan.)

The matrix below shows the format for a set-up where column factor A has two levels, row factor B has three levels, and there are two replications (reps=2). The subscripts indicate row, column, and replicate, respectively.

When reps is 1 (default), anova2 returns two p-values in vector p:

  1. The p-value for the null hypothesis, H0A, that all samples from factor A (i.e., all column-samples in X) are drawn from the same population
  2. The p-value for the null hypothesis, H0B, that all samples from factor B (i.e., all row-samples in X) are drawn from the same population

When reps is greater than 1, anova2 returns a third p-value in vector p:

  1. The p-value for the null hypothesis, H0AB, that the effects due to factors A and B are additive (i.e., that there is no interaction between factors A and B)

If any p-value is near zero, this casts doubt on the associated null hypothesis. A sufficiently small p-value for H0A suggests that at least one column-sample mean is significantly different that the other column-sample means; i.e., there is a main effect due to factor A. A sufficiently small p-value for H0B suggests that at least one row-sample mean is significantly different than the other row-sample means; i.e., there is a main effect due to factor B. A sufficiently small p-value for H0AB suggests that there is an interaction between factors A and B. The choice of a limit for the p-value to determine whether a result is "statistically significant" is left to the researcher. It is common to declare a result significant if the p-value is less than 0.05 or 0.01.

anova2 also displays a figure showing the standard ANOVA table, which divides the variability of the data in X into three or four parts depending on the value of reps:

The ANOVA table has five columns:

p = anova2(X,reps,'displayopt') enables the ANOVA table display when 'displayopt' is 'on' (default) and suppresses the display when 'displayopt' is 'off'.

[p,table] = anova2(...) returns the ANOVA table (including column and row labels) in cell array table. (Copy a text version of the ANOVA table to the clipboard by using the Copy Text item on the Edit menu.)

[p,table,stats] = anova2(...) returns a stats structure that you can use to perform a follow-up multiple comparison test.

The anova2 test evaluates the hypothesis that the row, column, and interaction effects are all the same, against the alternative that they are not all the same. Sometimes it is preferable to perform a test to determine which pairs of effects are significantly different, and which are not. Use the multcompare function to perform such tests by supplying the stats structure as input.

Examples

The data below come from a study of popcorn brands and popper type (Hogg 1987). The columns of the matrix popcorn are brands (Gourmet, National, and Generic). The rows are popper type (Oil and Air.) The study popped a batch of each brand three times with each popper. The values are the yield in cups of popped popcorn.

The vector p shows the p-values for the three brands of popcorn, 0.0000, the two popper types, 0.0001, and the interaction between brand and popper type, 0.7462. These values indicate that both popcorn brand and popper type affect the yield of popcorn, but there is no evidence of a synergistic (interaction) effect of the two.

The conclusion is that you can get the greatest yield using the Gourmet brand and an Air popper (the three values popcorn(4:6,1)).

Reference

[1]  Hogg, R. V. and J. Ledolter. Engineering Statistics. MacMillan Publishing Company, 1987.

See Also
anova1, anovan


  anova1 anovan