Documentation |
Variance ignoring NaNs
y = nanvar(X) y = nanvar(X,1) y = nanvar(X,W) y = nanvar(X,W,DIM)
X | Financial times series object. |
W | Weight vector. |
DIM | Dimension along which the operation is conducted. |
nanvar for financial times series objects is based on the Statistics Toolbox™ function nanvar. See nanvar in the Statistics Toolbox documentation.
y = nanvar(X) returns the sample variance of the values in a financial time series object X, treating NaNs as missing values. y is the variance of the non-NaN elements of each series in X.
nanvar normalizes y by N – 1 if N > 1, where N is the sample size of the non-NaN elements. This is an unbiased estimator of the variance of the population from which X is drawn, as long as X consists of independent, identically distributed samples, and data are missing at random. For N = 1, y is normalized by N.
y = nanvar(X,1) normalizes by N and produces the second moment of the sample about its mean. nanvar(X, 0) is the same as nanvar(X).
y = nanvar(X,W) computes the variance using the weight vector W. The length of W must equal the length of the dimension over which nanvar operates, and its non-NaN elements must be nonnegative. Elements of X corresponding to NaN elements of Ware ignored.
y = nanvar(X,W,DIM) takes the variance along dimension DIM of X.