Function File: nanvar (x)
Function File: v = nanvar (X, opt)
Function File: v = nanvar (X, opt, dim)

Compute the variance while ignoring NaN values.

For vector arguments, return the (real) variance of the values. For matrix arguments, return a row vector containing the variance for each column.

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

0:

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

1:

Normalizes with N, this provides the second moment around the mean.

The third argument dim determines the dimension along which the variance is calculated.

See also: var, nanmean, nanstd, nanmax, nanmin.

Package: statistics