[GRASS-dev] Re: [GRASS-user] Re: Calculating standard error of
many maps?
Glynn Clements
glynn at gclements.plus.com
Fri Feb 13 09:35:52 EST 2009
Hamish wrote:
> > I can add sum of squares/cubes/etc to r.series easily
> > enough if there is a use for them.
>
> well, sum of squares is useful so you can calculate variance & friends.
> don't know of any use for cubes+.
Skew needs sum(x^3), kurtosis needs sum(x^4).
> r.univar/stats.c:
> /* all these calculations get promoted to doubles, so any DIV0 becomes nan */
> mean = stats->sum / stats->n;
> variance = (stats->sumsq - stats->sum * stats->sum / stats->n) / stats->n;
> if (variance < GRASS_EPSILON)
> variance = 0.0;
> stdev = sqrt(variance);
> var_coef = (stdev / mean) * 100.; /* perhaps stdev/fabs(mean) ? */
>
>
> adding sum of sq would let people calc that with r.series+r.mapcalc
> manually.
>
> not sure what components are required to calc kurtosis & skewness,
> although I've an idea that they'd be possible with a single-serial-pass
> construction method as s.cellstats had them (??).
Like variance, it's possible to calculate them in a single pass
(v.univar does so), but the inaccuracies of a single-pass calculation
will get worse with higher powers.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list