# ANOVA (One-Way ANOVA) (G Dataflow)

Performs a one-way analysis of variance (ANOVA) and determines whether the factor has a significant effect on the experimental outcome.  ## levels

Number of levels in the factor. levels must be equal to or greater than 2. Otherwise, this node returns an error.

Default: 2 ## x

All the observational data. You must make at least one observation per level. Otherwise, this node returns an error. ## index

The level to which the corresponding observation belongs.

This node converts arrays that do not begin with 0 or have nonconsecutive values into arrays of consecutive values that begin with 0. For example, if you enter [3, 5, 7], this node converts the array into [0, 1, 2]. ## error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error  If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error ## significance level

Acceptable probability that this node incorrectly rejects a true null hypothesis.

significance level is a threshold value used to judge whether a factor has a significant effect on the experimental outcome.

Default: 0.05 ## significance

Probability that a value sampled from the F distribution with dofa and dofe degrees of freedom is greater than fa, where dofa, dofe, and fa are elements in summary.

Algorithm for Calculating significance

This node calculates significance using the following equation:

$\mathbf{s}\mathbf{i}\mathbf{g}\mathbf{n}\mathbf{i}\mathbf{f}\mathbf{i}\mathbf{c}\mathbf{a}\mathbf{n}\mathbf{c}\mathbf{e}=\mathrm{Prob}\left\{{F}_{\mathrm{dofa},\text{\hspace{0.17em}}\text{\hspace{0.17em}}\mathrm{dofe}}>\mathrm{fa}\right\}$

where Fdofa, dofe is the F distribution with dofa and dofe degrees of freedom. ## summary

A 2-by-5 matrix that displays the obtained values for analysis.

$\mathrm{summary}=\left[\begin{array}{cc}\mathrm{ssa}& \mathrm{dofa}\\ \mathrm{sse}& \mathrm{dofe}\end{array}\phantom{\rule{0ex}{0ex}}\text{\hspace{0.17em}}\phantom{\rule{0ex}{0ex}}\phantom{\square }\begin{array}{cc}\mathrm{msa}& \mathrm{fa}\\ \mathrm{mse}& \mathrm{0.0}\end{array}\begin{array}{c}\mathrm{F critical}\\ \mathrm{0.0}\end{array}\right]$

where

• ssa and sse are the sums of squares associated with the factor and residual error, respectively
• dofa and dofe are the respective degrees of freedom
• msa and mse are the respective mean squares
• fa is the F value
• F critical is the F critical value that corresponds to significance level

Algorithm for Calculating Sums of Squares

This node calculates the sums of squares using the following equations:

$\mathrm{ssa}=\underset{i=0}{\overset{k-1}{\sum }}\underset{m=0}{\overset{{n}_{i}-1}{\sum }}{\left(\stackrel{¯}{{x}_{i\cdot }}-\stackrel{¯}{{x}_{\cdot \cdot }}\right)}^{2}$
$\mathrm{sse}=\underset{i=0}{\overset{k-1}{\sum }}\underset{m=0}{\overset{{n}_{i}-1}{\sum }}{\left({x}_{im}-\stackrel{¯}{{x}_{i\cdot }}\right)}^{2}$

where

• k is the number of levels
• i is the index of each level, starting from 0
• ni is the number of observational data at the ith level
• m is the index of each observational data at a certain level, starting from 0
• $\stackrel{¯}{{x}_{i\cdot }}$ is the mean of all the observational data at the ith level
• $\stackrel{¯}{{x}_{\cdot \cdot }}$ is the mean of all the observational data
• xim is the mth observation data of the ith level

Algorithm for Calculating Degrees of Freedom

This node calculates the degrees of freedom using the following equations:

$\mathrm{dofa}=k-1$
$\mathrm{dofe}=n-k$

where

• k is the number of levels
• n is the number of all the observational data

Algorithm for Calculating Mean Squares

This node calculates the mean squares using the following equations:

$\mathrm{msa}=\frac{\mathrm{ssa}}{\mathrm{dofa}}$
$\mathrm{mse}=\frac{\mathrm{sse}}{\mathrm{dofe}}$

where

• ssa is a measure of variation attributed to the factor
• dofa is the degree of freedom of ssa
• sse is a measure of variation attributed to random fluctuation
• dofe is the degree of freedom of sse

Algorithm for Calculating the F Value

This node calculates the F value using the following equation:

$\mathrm{fa}=\frac{\mathrm{msa}}{\mathrm{mse}}$

where

• msa is the mean square quantity of ssa
• mse is the mean square quantity of sse

Algorithm for Calculating the F Critical Value

F critical is the value satisfying the following equation:

$\mathrm{Prob}\left\{{F}_{\mathrm{dofa},\text{\hspace{0.17em}}\text{\hspace{0.17em}}\mathrm{dofe}}\ge F\mathit{critical}\right\}=\mathbf{significance}\text{\hspace{0.17em}}\mathbf{level}$

where Fdofa, dofe is the F distribution with dofa and dofe degrees of freedom. ## significant?

Boolean value that indicates whether the factor has a significant effect on the experimental outcome.

 True significance is equal to or less than significance level, which means the factor has a significant effect on the experimental outcome. False significance is greater than significance level, which means the factor does not have a significant effect on the experimental outcome. ## error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error  If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Using age as a factor, this example demonstrates how to test whether age has a significant effect on the number of sit-ups a person can do.

The following table defines the levels of age.

 Level 0 6 years old to 10 years old Level 1 11 years old to 15 years old Level 2 16 years old to 20 years old

The following table lists the results of a random sampling of six people. The results are based on a series of observations of how many sit-ups people from different age groups can do. Note

To perform a one-way analysis of variance, you must make at least one observation per level.

 Person 1 8 years old (Level 0) 10 sit-ups Person 2 12 years old (Level 1) 15 sit-ups Person 3 16 years old (Level 2) 20 sit-ups Person 4 20 years old (Level 2) 25 sit-ups Person 5 13 years old (Level 1) 17 sit-ups Person 6 10 years old (Level 0) 12 sit-ups

The following table lists the inputs and outputs of this node.

 levels 3 x [10, 15, 20, 25, 17, 12] index [0, 1, 2, 2, 1, 0] significance level 0.05 significance 0.0367 summary ssa 133 sse 16.5 dofa 2 dofe 3 msa 66.5 mse 5.5 fa 12.0909 0.0 0 F critical 9.55209 0.0 0 significant? True

Because significant? is True, you can conclude that based on the sampling data, age has a significant effect on the number of sit-ups a person can do.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported

Web Server: Not supported in VIs that run in a web application