[Top][All Lists]

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

Re: max() and min() of nan/inf

From: Mike Miller
Subject: Re: max() and min() of nan/inf
Date: Thu, 23 Sep 1999 11:35:30 -0500 (CDT)

On Thu, 23 Sep 1999, Mirek Kwasniak wrote:

> it's much simple to use somthing like
>    max( x( finite( x ) ) )
>    min( x( finite( x ) ) )

A few years ago, when MATLAB was developing their stats toolbox, they
added the functions nansum, nanmean, nanmedian, nanvar, nanstd, nanmax,
nanmin, nancov and nancorr.  These functions were identical to sum, mean,
median, var, std, max, min, cov and corrcoef except that they ignored NaNs
in the computations (they do not ignore Inf and -Inf).  I believe they
dropped some of these in the final product, or maybe they were in the
first release of the toolbox and were taken out of the second release.  
Either way, MATLAB no longer has nanvar, nancov and nancorr (don't ask me
why they retained nanstd and dropped nanvar!)  I liked all of those
functions and I wish they were still there.

Does octave have any of those functions?  They would be very useful to me.
Mirek's example above works only for a vector and it doesn't deal with Inf
and -Inf properly (it discards them).  It's a little more involved to
write the nan functions for *matrices* while taking Inf and -Inf into
account.  nancov and nancorr would be tricky to produce because all pairs
of columns have to be dealt with and NaNs are not always in the same rows
in the different columns.

Has anybody already written these functions for Octave?  (I downloaded an
Octave stat toolbox, but it doesn't seem to have them.)  If not, is
anybody willing to write them?  I'll beta test them, but I don't have time
right now to write them.



Michael B. Miller
University of Missouri--Columbia

Octave is freely available under the terms of the GNU GPL.  To ensure
that development continues, see
Instructions for unsubscribing:

reply via email to

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