Function File: [pval, f, df_b, df_e] = anovan (data, grps)
Function File: [pval, f, df_b, df_e] = anovan (data, grps, 'param1', value1)

Perform a multi-way analysis of variance (ANOVA). The goal is to test whether the population means of data taken from k different groups are all equal.

Data is a single vector data with groups specified by a corresponding matrix of group labels grps, where grps has the same number of rows as data. For example, if data = [1.1;1.2]; grps= [1,2,1; 1,5,2]; then data point 1.1 was measured under conditions 1,2,1 and data point 1.2 was measured under conditions 1,5,2. Note that groups do not need to be sequentially numbered.

By default, a ’linear’ model is used, computing the N main effects with no interactions. this may be modified by param ’model’

p= anovan(data,groups, ’model’, modeltype) - modeltype = ’linear’: compute N main effects - modeltype = ’interaction’: compute N effects and N*(N-1) two-factor interactions - modeltype = ’full’: compute interactions at all levels

Under the null of constant means, the statistic f follows an F distribution with df_b and df_e degrees of freedom.

The p-value (1 minus the CDF of this distribution at f) is returned in pval.

If no output argument is given, the standard one-way ANOVA table is printed.

BUG: DFE is incorrect for modeltypes != full

Package: statistics