rbinomial: Simulates from a binomial distribution

Description Usage Arguments Details Value See Also Examples

View source: R/stochastic_simulation.R

Description

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).

Usage

1
rbinomial(size, prob)

Arguments

size

An integer scalar. The number of trials.

prob

A numeric scalar. The probability of success on each trial.

Details

Take a look at this function's code in the Stochastic Simulation vignette and see whether you can understand how it works.

Value

A numeric scalar: the simulated number of successes in size trials.

See Also

link{rbinom} for the official R function for simulating from a binomial distribution.

Examples

1
2
# Simulate one value from a binomial(6, 0.2) distribution.
rbinomial(size = 6, prob = 0.2)

paulnorthrop/stat1004 documentation built on Nov. 17, 2019, 3:49 a.m.