[GRASS-user] resampling question

Kirk Wythers kwythers at umn.edu
Thu Oct 20 11:20:11 EDT 2011


On Oct 20, 2011, at 9:22 AM, Dylan Beaudette wrote:

> The neat thing about GRASS and other OSS, you can always take a peak at the 
> source code. From my basic understanding of C, I don't think that there is 
> anything here that would accommodate ties-- so the result of 
> mode(4,4,4,4,5,5,5,5) would probably be 4 -- as it comes first. This is the 
> behavior in R when using something like which.max(table(x)).

Thanks for the reply Dylan. As I read through the code you pasted, it looks to me that as the variable 'values' gets counted, then in the case of a tie, such as this 2 x 2 matrix 

_____
| 4 | 5 |
_____
| 4 | 5 |
_____

would yield a mode result of 4 with the logic that the tie goes to the smallest value in sorted list of values? In this case...  4 4 5 5 = mode of 4, where as a sorted list such as 1 2 3 4 would yield a mode of 1? 

Is that right? 





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20111020/8f3802bc/attachment.html


More information about the grass-user mailing list