Re: v.univar
Roger Bivand <Roger.Bivand <at> nhh.no>
2004-07-02 17:52:02 GMT
On Fri, 2 Jul 2004, Radim Blazek wrote:
> I have written v.univar. I am not sure how to calculate statistics
> for lines and areas, does the code below make sense?
Briefly, no. You are calculating weighted means, weighting by line length
or area surface size. I think it would be better to treat each line or
area as a discrete, unweighted, unit unless some reason to the contrary is
given, just like points/sites. It is probably more important to handle
missing data gracefully than weight the means or other statistics, I
think. There may be reasons to weight sometimes, but most often I see
ratios or rates of two variables, rather than of a single variable and
length or area.
Roger
> Radim
>
> Lines:
> for each line {
> sum += line_length * variable;
> sumsq += line_length * variable * variable;
> total_length += line_length;
> }
> mean = sum / total_lenght;
> population_variance = (sumsq - sum*sum/total_length)/total_length;
> population_stdev = sqrt(population_variance);
>
> Areas:
> for each area {
(Continue reading)