Why does STD return NaN for financial time series with missing values (NaNs)?

STD returns NaN when operating on financial time series containing NaN values. This happens when I execute the code below:
dates = {'jan-01-2001'; 'jan-02-2001'; 'jan-03-2001'; ...
'jan-04-2001'; 'jan-06-2001'};
data = [1; NaN; 1; NaN; 1];
t1 = fints(dates, data);
std(t1)
This behavior is also observed when I use MEAN on the same object.

 Accepted Answer

This enhancement has been incorporated in Financial Toolbox 3.4 (R2008a). For previous product releases, read below for any possible workarounds:
The ability to treat NaN as missing values is not available using STD for financial time series using Financial Toolbox 3.2 (R2007a). As a workaround, you can extract the data to a matrix and compute the standard deviation using NANSTD in the Statistics Toolbox.

More Answers (0)

Products

Release

R2007a

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!