Analysis of Variance Package

This package provides functions for performing a univariate Analysis of Variance (ANOVA) to examine the differences between groups of means. The function ANOVA can handle models with any number of fixed factors in a crossed design. It can handle both balanced and unbalanced data with or without missing elements. All results are given as type I sums of squares. ANOVA also provides a number of posthoc tests for comparisons.

ANOVA[data]perform a oneway analysis of variance
ANOVA[data,model,vars]perform a general ANOVA specified by the given model and vars

The ANOVA function.

The data must be of the form where , , and so on are the values of the categorical variables vars associated with the response, .

The vars argument is a list of symbols representing the categorical variables in the model.

The model argument is a list of main effects and interactions that together specify the model. The interaction terms are given as the product of variables. For example, the full factorial model for a threeway analysis of variance can be written as , where α, β, γ are the main effects, α β, α γ, β γ are the twoway interactions, and α is the threeway interaction. Models can also be written using All to represent all main effects and interactions between the specified categorical variables. The full factorial model for a threeway analysis of variance can therefore also be written as {α,β,γ,All}.

This loads the package.
In[1]:=
Click for copyable input
This defines data of one categorical variable.
In[2]:=
Click for copyable input
This performs a oneway ANOVA on the data.
In[3]:=
Click for copyable input
Out[3]=
This defines data of a categorical variable with two levels and a categorical variable with three levels.
In[4]:=
Click for copyable input
This performs a full factorial twoway ANOVA.
In[5]:=
Click for copyable input
Out[5]=
Dropping the point gives an unbalanced twoway ANOVA with an empty cell.
In[6]:=
Click for copyable input
Out[6]=
Here is a balanced threeway dataset.
In[7]:=
Click for copyable input
Here is a threeway ANOVA with main effects and twoway interactions.
In[8]:=
Click for copyable input
Out[8]=
option name
default value
CellMeansTruewhether to give a list of means for each group
WorkingPrecisionMachinePrecisionprecision of the arithmetic to use in calculations
PostTests{}list of posthoc tests to perform
SignificanceLevel0.05significance level criteria for posthoc tests

Options for ANOVA.

Bonferronimean comparison test based on the Student t distribution with modified α based on the number of groups
Duncanliberal range test based on the Studentized range distribution
StudentNewmanKeulsconservative range test based on the Studentized range distribution
Tukeymean comparison test based on the Studentized range distribution
Dunnettcomparison test of group means against a control, taken to be the first group

Available tests for the PostTests option.

Tukey's test finds groups 1 and 4 significantly different from group 3 at the 5% level.
In[9]:=
Click for copyable input
Out[9]=
Bonferroni and Tukey's tests find groups 3 and 4 significantly different at the 1% level.
In[10]:=
Click for copyable input
Out[10]=