[GRASS5] s.univar + s.windavg + new code = s.cellstats

Eric G. Miller egm2 at jps.net
Wed Sep 18 04:11:56 EDT 2002


On Wed, Sep 18, 2002 at 09:49:37AM +0200, Roger Bivand wrote:
> On Wed, 18 Sep 2002, Eric G. Miller wrote:
> 
> > It came up on the other list about calculating s.univar stats
> > for sites in a cell.  I've been going back and forth with Gordon Keith
> > on the other list and privately, about a modified s.univar.
> > 
> > Anyway, I've got most of a version but I hit a snag when the count
> > for a cell is one.  Some of the stats come up NaN.  At the moment,
> > I've hooked in modifications so the offending stats don't divide
> > by zero (which was the problem).  Now, if there's just one data point,
> > what are appropriate values for:
> > 
> >   standard deviation (0.0 ?)
> >   skewness (0.0 ?)
> >   kurtosis (-3.0?)
> >   coefficient of variation (0.0?)
> 
> >From R
> 
> > x <- 2
> > mean(x)
> [1] 2
> > sd(x)
> [1] NA
> > library(e1071)
> > kurtosis(x)
> [1] NA
> > skewness(x)
> [1] NA
> 
> where NA is not available, here not defined. Zero is wrong by definition, 
> but Inf is a possibility - at least for variance or standard deviation. Do 
> we have a general NULL that could be used?

There isn't a way to store NULL in sites files (NaN would be approriate,
but the library doesn't support it).  Maybe zero will have to do.  A
sample size of one is about as useful as an anecdote anyway... ;-)

-- 
begin 664 .signature
M<F5L;&E-("Y'(&-I<D4@/G1E;BYS<&I`,FUG93P)"`@("`@("`@("`@("`@(
M"`@("`@("`@("`@("`@("`A%<FEC($<N($UI;&QE<B`\96=M,D!J<',N;F5T
"/@H`
`
end




More information about the grass-dev mailing list