Products & Services Industries Academia Support User Community Company

Learn more about Financial Toolbox   

nanstd - Standard deviation ignoring NaNs

Syntax

y = nanstd(X)
y = nanstd(X,1)
y = nanstd(X,FLAG,DIM)

Arguments

X

Financial times series object.

FLAG

Normalization flag.

DIM

Dimension along which the operation is conducted.

Description

nanstd for financial times series objects is based on the Statistics Toolbox function nanstd. See nanstd in the Statistics Toolbox documentation.

y = nanstd(X) returns the sample standard deviation of the values in a financial time series object X, treating NaNs as missing values. y is the standard deviation of the non-NaN elements of X.

nanstd normalizes y by (N1), where N is the sample size. This is the square root of 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.

y = nanstd(X,1) normalizes by N and produces the square root of the second moment of the sample about its mean. nanstd(X,0) is the same as nanstd(X).

y = nanstd(X,flag,dim) takes the standard deviation along the dimension dim of X. Set the value of flag to 0 to normalize the result by n1; set the value of flag to 1 to normalize the result by n.

Examples

To compute nanstd for the following dates:

dates = {'01-Jan-2007';'02-Jan-2007';'03-Jan-2007'};
f = fints(dates, magic(3));
f.series1(1) = nan;
f.series2(3) = nan;
f.series3(2) = nan;

nstd = nanstd(f)

See Also

nanmax, nanmean, nanmedian, nanmin, nanvar, std

  


Free Interactive Computational Finance CD

View demos and recorded presentations led by industry experts.

Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS