powered by
Density, distribution function, quantile function and random generation for the Bernoulli distribution with probability equals to prob.
dbern(x, prob=.5, log=FALSE) pbern(q, prob=.5, lower.tail=TRUE, log.p=FALSE) qbern(p, prob=.5, lower.tail=TRUE, log.p=FALSE) rbern(n, prob=.5)
dbern gives the density, pbern gives the distribution function, qbern gives the quantile function, and rbern
generates random deviates.
vector of quantiles.
vector of probabilities.
number of observations. If length(n) > 1, the length is taken to be the number required.
vector of probabilities of success of each trial.
logical; if TRUE, probabilities p are given as log(p).
logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x].
These functions use the corresponding functions from the binomial distribution with argument size = 1. Thus, 1 is for success, 0 is for failure.
binomial
Binomial
rbern(n=10, prob=.5) rbern(n=3, prob=c(0, .5, 1))
Run the code above in your browser using DataLab