# Measures of Spread (Standard Deviation and Variance) (G Dataflow)

Version:

Computes the mean, standard deviation, and variance of the values in a sequence.

## x

The input sequence.

## weighting

Whether to calculate the population or the sample standard deviation and variance.

Name Description
Sample

Calculates the sample standard deviation and variance.

Population

Calculates the population standard deviation and variance.

Default: Sample

## error in

Error conditions that occur before this node runs. The node responds to this input according to standard error behavior.

Default: No error

## mean

Mean, or average, of the values in the input sequence.

## standard deviation

Standard deviation calculated from the values in the input sequence.

## variance

Calculated variance of the values in the input sequence.

## error out

Error information. The node produces this output according to standard error behavior.

## Algorithm for Computing the Mean, Deviation, and Variance

The node calculates the output values using the following equations.

$\mu =\underset{i=0}{\overset{n-1}{\sum }}\frac{{x}_{i}}{n}$

where $\mu$ is mean and n is the number of elements in x.

$\mathrm{standard}\text{\hspace{0.17em}}\mathrm{deviation}=\sigma$
${\sigma }^{2}=\underset{i=0}{\overset{n-1}{\sum }}\frac{{\left({x}_{i}-\mu \right)}^{2}}{w}$

where

• ${\sigma }^{2}$is variance
• $\mu$is mean
• w is n when weighting is Population and (n - 1) when weighting is Sample

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported