[R-sig-Geo] Not so random sampleRandom in raster package
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Fri Feb 10 08:29:25 CET 2012
On 02/10/2012 08:00 AM, Tom Gottfried wrote:
> Edzer,
>
> Am 09.02.2012 17:58, schrieb Edzer Pebesma:
>>
>>
>> On 02/09/2012 05:02 PM, Etienne B. Racine wrote:
>>> It seems that sampleRandom isn't so random.
>>>
>>> # try this :
>>> library(raster)
>>> r<- raster(matrix(1:25, 5, 5))
>>> sampleRandom(r, 25)
>>> ## 1 6 11 16 21 2 7 12 17 22 3 8 13 18 23 4 9 14 19 24 5 10 15
>>> sampleRandom(r, 25)
>>> ## 1 6 11 16 21 2 7 12 17 22 3 8 13 18 23 4 9 14 19 24 5 10 15
>>>
>>> I haven't seen any documentation about this behavior.
>>>
>>
>> Isn't the more important question whether you saw documentation that is
>> in conflict with this behaviour?
>
> taking that to the extremes: undocumented software always works perfectly.
And is useless, too -- no, these kind of questions are often highly
useful because they improve software or the documentation, and both are
valuable activities.
>From the base::sample analogy, I would have expected a random
permutation, so IMO it would make sense to document this is not the case
(the function is not called sample, anyway -- question are: what would
the random permutation be good for? and would it still perform well when
the image is huge?)
>
> (By the way I've heard that's the way ESRI did it with their
> "Geostatistical Analyst")
>
You might be mixing up things here or have outdated information; the
author of Geostatistical Analyst published in 2011 (at ESRI press) a
nearly 1000 page e-book "Spatial Statistical Data Analysis for GIS
users", which obviously addresses ArcGIS, but also R and WinBugs for
areas where ArcGIS does not offer solutions. He is on this list, too.
--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics e.pebesma at wwu.de
More information about the R-sig-Geo
mailing list