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)
-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 playing around, I discovered
@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:
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
Greetings. My wife is teaching an introductory stat class at UC Davis. The
class emphasizes the use of simulations, rather than mathematics, to get
insight into statistics, and R is the mandated tool. A student in the class
recently inquired about different approaches to sampling from a
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.
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 otherwise.
6 matches
Mail list logo