Re: [R] sample(c(0, 1)...) vs. rbinom

2013-05-23 Thread Albyn Jones
n Jones > > Sent: Thursday, May 23, 2013 8:30 AM > > To: r-help@r-project.org > > Subject: Re: [R] sample(c(0, 1)...) vs. rbinom > > > > After a bit of playing around, I discovered that > > sample() does something similar in other situations: > > &g

Re: [R] sample(c(0, 1)...) vs. rbinom

2013-05-23 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Albyn Jones > Sent: Thursday, May 23, 2013 8:30 AM > To: r-help@r-project.org > Subject: Re: [R] sample(c(0, 1)...) vs. rbinom > > After a bit of play

Re: [R] sample(c(0, 1)...) vs. rbinom

2013-05-23 Thread Albyn Jones
After a bit of playing around, I discovered that sample() does something similar in other situations: set.seed(105021) sample(1:5,1,prob=c(1,1,1,1,1)) [1] 3 set.seed(105021) sample(1:5,1) [1] 2 set.seed(105021) sample(1:5,5,prob=c(1,1,1,1,1)) [1] 3 4 2 1 5 set.seed(105021) sample(1:5,5)

Re: [R] sample(c(0, 1)...) vs. rbinom

2013-05-22 Thread peter dalgaard
On May 23, 2013, at 07:01 , Jeff Newmiller wrote: > You seem to be building an elaborate structure for testing the > reproducibility of the random number generator. I suspect that rbinom is > calling the random number generator a different number of times when you pass > prob=0.5 than otherwis

Re: [R] sample(c(0, 1)...) vs. rbinom

2013-05-22 Thread Jeff Newmiller
You seem to be building an elaborate structure for testing the reproducibility of the random number generator. I suspect that rbinom is calling the random number generator a different number of times when you pass prob=0.5 than otherwise. -