I tried the following comm in Linux(Ubuntu), It works well: >set.seed(43);runif(3):rnorm(3) >set.seed(43);runif(3);rnorm(3)
At 2011-03-26 19:00:05£¬[email protected] wrote: >Send R-SIG-Debian mailing list submissions to > [email protected] > >To subscribe or unsubscribe via the World Wide Web, visit > https://stat.ethz.ch/mailman/listinfo/r-sig-debian >or, via email, send a message with subject or body 'help' to > [email protected] > >You can reach the person managing the list at > [email protected] > >When replying, please edit your Subject line so it is more specific >than "Re: Contents of R-SIG-Debian digest..." > > >Today's Topics: > > 1. set.seed (Biau David) > 2. Re: set.seed (Dirk Eddelbuettel) > > >---------------------------------------------------------------------- > >Message: 1 >Date: Sat, 26 Mar 2011 00:30:32 +0000 (GMT) >From: Biau David <[email protected]> >To: R-debian <[email protected]> >Subject: [R-sig-Debian] set.seed >Message-ID: <[email protected]> >Content-Type: text/plain > >Dear list, > >It looks like set.seed does not work for me (see code below). I am running >Debian squeeze. Is this an issue with the distribution or with my >understanding >of the function? I'm pretty sure, but not certain, it used to work that way on >windows > >> runif(5) >[1] 0.6516557 0.5677378 0.1135090 0.5959253 0.3580500 >> runif(5) >[1] 0.42880942 0.05190332 0.26417767 0.39879073 0.83613414 >> set.seed(15) >> runif(5) >[1] 0.6021140 0.1950439 0.9664587 0.6509055 0.3670719 >> runif(5) >[1] 0.9888592 0.8151934 0.2539684 0.6872308 0.8314290 > > >Any help would be appreciated. Thx, > >David Biau. > > [[alternative HTML version deleted]] > > > >------------------------------ > >Message: 2 >Date: Fri, 25 Mar 2011 23:33:07 -0500 >From: Dirk Eddelbuettel <[email protected]> >To: Biau David <[email protected]> >Cc: R-debian <[email protected]> >Subject: Re: [R-sig-Debian] set.seed >Message-ID: <[email protected]> >Content-Type: text/plain; charset=us-ascii > > >On 26 March 2011 at 00:30, Biau David wrote: >| Dear list, >| >| It looks like set.seed does not work for me (see code below). I am running >| Debian squeeze. Is this an issue with the distribution or with my >understanding >| of the function? I'm pretty sure, but not certain, it used to work that way >on >| windows >| >| > runif(5) >| [1] 0.6516557 0.5677378 0.1135090 0.5959253 0.3580500 >| > runif(5) >| [1] 0.42880942 0.05190332 0.26417767 0.39879073 0.83613414 >| > set.seed(15) >| > runif(5) >| [1] 0.6021140 0.1950439 0.9664587 0.6509055 0.3670719 >| > runif(5) >| [1] 0.9888592 0.8151934 0.2539684 0.6872308 0.8314290 >| >| Any help would be appreciated. Thx, > >You need to set the seed, then draw -- then re-seed and re-draw: > >R> set.seed(42); runif(3); rnorm(3) >[1] 0.0161408 0.0922721 0.5505511 >[1] -1.0898031 -0.0143024 0.5808842 >R> set.seed(42); runif(3); rnorm(3) >[1] 0.0161408 0.0922721 0.5505511 >[1] -1.0898031 -0.0143024 0.5808842 >R> runif(3); rnorm(3) >[1] 0.623570 0.854190 0.420727 >[1] -0.246359 0.195088 0.160348 >R> > >Identical when I fix the seed, not when I don't. Makes sense? > >Dirk > > >-- >Dirk Eddelbuettel | [email protected] | http://dirk.eddelbuettel.com > > > >------------------------------ > >_______________________________________________ >R-SIG-Debian mailing list >[email protected] >https://stat.ethz.ch/mailman/listinfo/r-sig-debian > > >End of R-SIG-Debian Digest, Vol 67, Issue 10 >******************************************** [[alternative HTML version deleted]]
_______________________________________________ R-SIG-Debian mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-debian

