[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-help
Subject:    Re: [R] Problem with random numbers/seed
From:       Rolf Turner <r.turner () auckland ! ac ! nz>
Date:       2019-06-21 23:27:23
Message-ID: 82419d92-7852-13a6-dc8c-5e683d78f534 () auckland ! ac ! nz
[Download RAW message or body]


On 22/06/19 5:21 AM, Steven Yen wrote:

> Unhappy but thanks.
> Steven

Well, if you're *really* unhappy (???) you could always do

     suppressWarnings(RNGversion("3.5.3"))

Does that make you happier?

cheers,

Rolf

> 
> On 6/22/2019 1:13 AM, Uwe Ligges wrote:
>>
>>
>> On 21.06.2019 19:09, Steven Yen wrote:
>>> Now I see that results were replicated but running RNGversion
>>> I get a warning message. Isn't there a way to do this clean?
>>
>> Well, the old RNG is known to be not optimal, hence we give a warning
>> if you choose the old one. This is the clean way if you really want to
>> get the old (slightly buggy) behaviour.
>>
>> Best,
>> Uwe Ligges
>>
>>>
>>>> RNGversion("3.5.3") Warning message: In RNGkind("Mersenne-Twister",
>>> "Inversion", "Rounding") : non-uniform 'Rounding' sampler used
>>>
>>>
>>> On 6/22/2019 1:03 AM, Uwe Ligges wrote:
>>>> What does not work?
>>>>
>>>>
>>>> For me it works under R-3.6.0:
>>>>
>>>>    x<-1:500
>>>>    set.seed(12345671)
>>>>    j<-sample(1:length(x),size=60); y<-x[j]
>>>>    summary(j)
>>>>
>>>>    RNGversion("3.5.3")
>>>>    set.seed(12345671)
>>>>    j<-sample(1:length(x),size=60); y<-x[j]
>>>>    summary(j)
>>>>
>>>>
>>>> Now I get the results you got udner the old R.
>>>>
>>>> Best,
>>>> Uwe Ligges
>>>>
>>>>
>>>>
>>>> On 21.06.2019 18:39, Steven Yen wrote:
>>>>> Thanks. Somewhat of a mystery. The older version I had was
>>>>> R-3.5.3patched.
>>>>> I cannot get the RNGversion command to run. Can you help? Thanks.
>>>>>
>>>>> On 6/22/2019 12:25 AM, Uwe Ligges wrote:
>>>>>> See the NEWS, the RNG has been changed, use RNGversion
>>>>>>
>>>>>> On 21.06.2019 18:10, Steven Yen wrote:
>>>>>>> Dear all,
>>>>>>> I did all this work with older R (R-3.5.3.patched and older)
>>>>>>> but now with R3.6 I cannot replicate the results.
>>>>>>> Below I sample 60 observations from 1:500 using the sample command
>>>>>>> with
>>>>>>> a random seed of 123. I get different results. Advice appreciated.
>>>>>>> Steven Yen
>>>>>>>
>>>>>>>     > # Run under R-3.6.0
>>>>>>>     > x<-1:500
>>>>>>>     > set.seed(12345671)
>>>>>>>     > j<-sample(1:length(x),size=60); y<-x[j]
>>>>>>>     > summary(y)
>>>>>>>        Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>>>>>>>        26.0   134.2   240.0   249.8   368.0   500.0
>>>>>>>
>>>>>>>     > # Run under R-3.5.3.patched
>>>>>>>     > x<-1:500
>>>>>>>     > set.seed(12345671)
>>>>>>>     > j<-sample(1:length(x),size=60); y<-x[j]
>>>>>>>     > summary(y)
>>>>>>>        Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>>>>>>>         9.0   122.2   205.0   236.1   364.2   493.0
>>>>>>>
>>>>>>
>>>>>>
>>>>>> Under R-3.6.0  use, e.g.
>>>>>> RNGversion("3.5.2")
>>>>>> to get reproducible results from the older RNG.
>>>>>>
>>>>>> Best,
>>>>>> Uwe Ligges
>>>>>>
>>>>>>
>>>>>
>>>>> -- 
>>>>> styen@ntu.edu.tw  (S.T. Yen)
>>>>>
>>>>
>>>
>>
>

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic