Navigation

Operators and Keywords

Function List:

C++ API

: var (x)
: var (x, opt)
: var (x, opt, dim)

Compute the variance of the elements of the vector x.

The variance is defined as

var (x) = 1/(N-1) SUM_i (x(i) - mean(x))^2

If x is a matrix, compute the variance for each column and return them in a row vector.

The argument opt determines the type of normalization to use. Valid values are

0:

normalize with N-1, provides the best unbiased estimator of the variance [default]

1:

normalizes with N, this provides the second moment around the mean

If N==1 the value of opt is ignored and normalization by N is used.

If the optional argument dim is given, operate along this dimension.

See also: cov, std, skewness, kurtosis, moment.

Package: octave