nanmean

Mean ignoring NaNs

nanmean is not recommended. Use timetable instead. For more information, see Convert Financial Time Series Objects fints to Timetables.

Syntax

m = nanmean(X)
m = nanmean(X,DIM)

Arguments

X

Financial time series object.

DIM

Dimension along which the operation is conducted.

Description

nanmean for financial time series objects is based on the Statistics and Machine Learning Toolbox™ function nanmean. See nanmean.

m = nanmean(X) returns the sample mean of a financial time series object X, treating NaNs as missing values. m is a row vector containing the mean value of the non-NaN elements in each series.

m = nanmean(X,DIM) takes the mean along dimension DIM of X.

Examples

To compute nanmean 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;

nmean = nanmean(f)
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints (line 165) 
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints/subsasgn (line 118) 
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints/subsasgn (line 118) 
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints/subsasgn (line 118) 
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints/nanmean (line 14) 

nmean =

    3.5000    3.0000    4.0000

See Also

| | | | |

Introduced before R2006a