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.

 采纳的回答

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.

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息

产品

版本

R2007a

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by