Statistics Toolbox    

Functions for Data with Missing Values (NaNs)

Most real-world data sets have one or more missing elements. It is convenient to code missing entries in a matrix as NaN (Not a Number).

Here is a simple example.

Any arithmetic operation that involves the missing values in this matrix yields NaN, as below.

Removing cells with NaN would destroy the matrix structure. Removing whole rows that contain NaN would discard real data. Instead, the Statistics Toolbox has a variety of functions that are similar to other MATLAB functions, but that treat NaN values as missing and therefore ignore them in the calculations.

In addition, other Statistics Toolbox functions operate only on the numeric values, ignoring NaNs. These include iqr, kurtosis, mad, prctile, range, skewness, and trimmean.


  Measures of Dispersion Function for Grouped Data