Description Usage Arguments Details Value See Also Examples
View source: R/stochastic_simulation.R
Simulates one value from a binomial distribution with parameters
size
(the number of independent Bernoulli trials) and prob
(the probability of success on any given trial).
1 | rbinomial(size, prob)
|
size |
An integer scalar. The number of trials. |
prob |
A numeric scalar. The probability of success on each trial. |
Take a look at this function's code in the Stochastic Simulation vignette and see whether you can understand how it works.
A numeric scalar: the simulated number of successes in size
trials.
link{rbinom}
for the official R function for simulating
from a binomial distribution.
1 2 | # Simulate one value from a binomial(6, 0.2) distribution.
rbinomial(size = 6, prob = 0.2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.