> 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.
I was wondering if some practical examples could be given? The only
thing I could think of is comparing "ground covered in a day" lengths.
This may not be what you were going for, but I have need for something
to help with the "length of border" question. As this is a fractal
problem, the line length is best reported as a ratio (given that the
whole exists at the same resolution).
e.g.
the border with Spain covers x% of Portugal's total borders.
the part of the coastline contained within some vector area represents
x% of the overall coastline.
The integral giving area converges to a real number though, so you could
give mean area + stdev of provinces in a country if you wanted (bad
example..).
In somewhat related matters, I'm planning on activating the C version of
r.univar soon, and for consistency changing r.series to use sample
variance instead of population variance. I think that with raster maps,
you only really have a whole population if you cover the entire planet..
???
This is still missing extended stats (quartiles, median, 10% trimmed
mean), hopefully someone can add that. I might keep the script version
around, renamed r.univar1, until we have that.
Hamish