


% -*- texinfo -*-
% @deftypefn {Function File} {[@var{pval}, @var{f}, @var{df_b}, @var{df_e}] =} anovan (@var{data}, @var{grps})
% @deftypefnx {Function File} {[@var{pval}, @var{f}, @var{df_b}, @var{df_e}] =} anovan (@var{data}, @var{grps}, 'param1', @var{value1})
% Perform a multi-way analysis of variance (ANOVA). The goal is to test
% whether the population means of data taken from @var{k} different
% groups are all equal.
%
% Data is a single vector @var{data} with groups specified by
% a corresponding matrix of group labels @var{grps}, where @var{grps}
% has the same number of rows as @var{data}. For example, if
% @var{data} = [1.1;1.2]; @var{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 @var{f} follows an F
% distribution with @var{df_b} and @var{df_e} degrees of freedom.
%
% The p-value (1 minus the CDF of this distribution at @var{f}) is
% returned in @var{pval}.
%
% If no output argument is given, the standard one-way ANOVA table is
% printed.
%
% BUG: DFE is incorrect for modeltypes ~= full
% @end deftypefn