octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NaN in statistics


From: Rik
Subject: Re: NaN in statistics
Date: Sat, 06 Jul 2013 10:01:25 -0700

On 07/06/2013 08:55 AM, address@hidden wrote:
> Message: 6
> Date: Sat, 6 Jul 2013 08:54:17 -0700 (PDT)
> From: CdeMills <address@hidden>
> To: address@hidden
> Subject: Non-contaminating emptyness indicator
> Message-ID: <address@hidden>
> Content-Type: text/plain; charset=us-ascii
>
> Hello,
>
> I have an application producing lots of data, collating everything into a
> matrix. Sometimes one entry is missing: I would like to fill it with
> something preserving the ability for statistical functions to return
> something meaningfull.
>
> For instance:
> A = randn(4, 4)
> A(2, 3) = NA;
> mean(A) => the third column result is 'NA'
>
> Same game for 'NaN'; furthermore 
> A(2, 3) = [] is rejected.
>
> What I would like is some option like R 'skipNA = true', meaning:
> - compute sum, mean, std, ... over some dimension, by default on a
> column-basis
> - extract a slice, and do not take into account NA and NaN values. For
> 'sum', the end result is a numeric value; provided at least one value is not
> special; for operations like 'mean' and 'std' the degrees of freedom have to
> be recomputed each time at least one NA/NaN is present.
>
> Any clue ? Could this option be implemented into the standard implementation
> ? I would like not to implement a new class where NaN are automatically
> discarded ?
7/6/13

Pascal,

This is a common problem.  Matlab has a whole series of functions in their
statistics toolbox which begin with "nan" and then the function name that
they replace.  So there is "nansum", "nanmean", "nanstd", etc.  Check the
Octave-Forge statistics package which includes the same functions
(http://octave.sourceforge.net/statistics/overview.html).

--Rik


reply via email to

[Prev in Thread] Current Thread [Next in Thread]