Description Usage Arguments Examples
Simulate n independent trials from a random variable X:
1 | rsim(X, n)
|
X |
A random variable |
n |
The number of independent trials to simulate |
1 2 3 4 5 6 7 8 9 10 | X.Bern <- RV(c(1,0), c(.5,.5))
X.Bern.sim100 <- rsim(X.Bern, 100)
X.loaded.die <- RV(1:6, odds = c(1,1,1,1,2,4))
X.loaded.die.sim100 <- rsim(X.loaded.die, 100)
# The function 'rsim()' attaches the probabilities as names to the random draws.
# To get the values only, use 'as.vector()':
as.vector(X.Bern.sim100)
as.vector(X.loaded.die.sim100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.