Function File: v = nanstd (X)
Function File: v = nanstd (X, opt)
Function File: v = nanstd (X, opt, dim)

Compute the standard deviation while ignoring NaN values.

nanstd is identical to the std function except that NaN values are ignored. If all values are NaN, the standard deviation is returned as NaN. If there is only a single non-NaN value, the deviation is returned as 0.

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

0:

normalizes with N-1, provides the square root of best unbiased estimator of the variance [default]

1:

normalizes with N, this provides the square root of the second moment around the mean

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

See also: std, nanmin, nanmax, nansum, nanmedian, nanmean.

Package: statistics