[R-sig-Geo] Not so random sampleRandom in raster package
Tom Gottfried
tom.gottfried at tum.de
Fri Feb 10 09:51:45 CET 2012
Am 10.02.2012 08:29, schrieb Edzer Pebesma:
>
>
> 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.
thanks, just ordered from the library to have a look and spread the word.
Tom
--
Technische Universität München
Department für Pflanzenwissenschaften
Lehrstuhl für Grünlandlehre
Alte Akademie 12
85350 Freising / Germany
Phone: ++49 (0)8161 715324
Fax: ++49 (0)8161 713243
email: tom.gottfried at wzw.tum.de
http://www.wzw.tum.de/gruenland
More information about the R-sig-Geo
mailing list