Function Repository Resource:

ANOVA

Source Notebook

Perform an analysis of variance

Contributed by: Wolfram Research

ResourceFunction["ANOVA"][data]

performs a one‐way analysis of variance.

ResourceFunction["ANOVA"][data,model,vars]

performs an analysis of variance for model as a function of the categorical variables vars.

Details and Options

The data can have the form {{x1,y1,,f1},{x2,y2,,f2},}, where the number of coordinates x,y, is equal to the number of variables in the list vars.
For data of the form {{x1,f1},{x2,f2},}, a one‐way analysis of variance can be obtained without explicitly specifying the model and variable.
The model argument can be a list containing main effects and interactions. Main effects are elements of vars, and interactions are products of main effects.
A full factorial model including all interactions between variables x,y, can be specified as {x,y,,All}.
The following options can be given:
"CellMeans"Truewhether cell means should be included in the output
WorkingPrecisionMachinePrecisionthe precision used in internal computations
"PostTests"{}significance tests to perform
SignificanceLevel0.05significance level for performed tests
Possible settings for "PostTests" include: "Bonferroni", "Duncan", "Dunnett", "StudentNewmanKeuls" and “Tukey”.

Examples

Basic Examples (2) 

A one‐way analysis of variance:

In[1]:=
ResourceFunction["ANOVA"][{{1, 1}, {1, 2}, {2, 4}, {2, 3}}]
Out[1]=

A two‐way analysis of variance:

In[2]:=
ResourceFunction[
 "ANOVA"][{{1, 1, 2}, {1, 1, 3}, {1, 2, 4}, {1, 2, 3}, {2, 1, 5}, {2, 1, 4}, {2, 2, 4}, {2, 2, 2}}, {x, y}, {x, y}]
Out[2]=

Options (4) 

CellMeans (1) 

Omit cell means from output:

In[3]:=
ResourceFunction["ANOVA"][{{1, 1}, {1, 2}, {2, 4}, {2, 3}}, "CellMeans" -> False]
Out[3]=

WorkingPrecision (1) 

Computation at precision 20:

In[4]:=
ResourceFunction["ANOVA"][{{1, 1}, {1, 2}, {2, 4}, {2, 3}}, WorkingPrecision -> 20]
Out[4]=

PostTests (1) 

Analysis of variance with Bonferroni test:

In[5]:=
ResourceFunction["ANOVA"][{{1, 1}, {1, 2}, {2, 15}, {2, 20}}, "PostTests" -> "Bonferroni"]
Out[5]=

SignificanceLevel (1) 

Bonferroni test at significance level .01:

In[6]:=
ResourceFunction["ANOVA"][{{1, 1}, {1, 2}, {2, 15}, {2, 20}}, "PostTests" -> "Bonferroni", SignificanceLevel -> .01]
Out[6]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 26 April 2019

License Information