On Tue, 19 Aug 2008, [EMAIL PROTECTED] wrote:

I sent this to R-devel early last month, but have received no response, so I 
guess it
really is a bug.

Or people were busy: I was away teaching a course, for example.

This looks like a bug to me, and is a bit hard to describe, but easy to 
reproduce.  
Basically, if RNGkind is saved as something other than the default, and if the 
first
operation in a session is a set.seed(), the default is reverted to.  Reproduce 
by:

A better description would certainly have helped! You can look at .Random.seed to see what is happening.

I think what you are observing is that if .Random.seed has not used in the session, any restored value is not used to set the default kind in set.seed. I don't think that is unreasonable (in particular as you can set the kind in set.seed() and I take the notes on ?RNG to suggest that), but would be easy to change/document.


cafe-rozo>  R --vanilla

R version 2.7.1 (2008-06-23)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

sessionInfo()
R version 2.7.1 (2008-06-23)
i386--netbsdelf

locale:
C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base
set.seed(1); runif(1)         # check the default
[1] 0.2655087
RNGkind("Mar")
RNGkind()
[1] "Marsaglia-Multicarry" "Inversion"
set.seed(1); runif(1)         # now check again
[1] 0.006153224
set.seed(1)                   # save seed and RNGkind
q("yes")
cafe-rozo>  R

R version 2.7.1 (2008-06-23)
: etc
[Previously saved workspace restored]

runif(1)              # with a saved seed, Marsaglia-Multicarry is used
[1] 0.006153224
set.seed(1); runif(1)
[1] 0.006153224
q()
Save workspace image? [y/n/c]: n
cafe-rozo>

R version 2.7.1 (2008-06-23)
: etc
[Previously saved workspace restored]

set.seed(1); runif(1)         # saved RNGkind is ignored ...
[1] 0.2655087
RNGkind()             # and overridden ...
[1] "Mersenne-Twister" "Inversion"
q("no")
cafe-rozo>  R

R version 2.7.1 (2008-06-23)
: etc
[Previously saved workspace restored]

RNGkind()             # and wrongly reported!
[1] "Mersenne-Twister" "Inversion"
runif(1)                      # Note this is actually using Marsaglia-Multicarry
[1] 0.006153224


Ray Brownrigg
Mathematics, Statistics and Computer Science
Victoria University of Wellington
Wellington, NZ

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


--
Brian D. Ripley,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to