rvbern {rv}R Documentation

Generate a Random Vector from a Bernoulli Sampling Model

Description

rvbern generates a random vector where each simulation comes from a Bernoulli sampling distribution.

Usage

  rvbern(n=1, prob)

Arguments

n number of random scalars to draw
prob probability of ``success"; may be a random vector itself

Details

rvbern is a special case of rvbinom with the argument size=1.

Value

A random vector (an rv object) of length n.

Note

The resulting vector will not be independent and identically distributed Bernoulli unless prob is a fixed number.

Author(s)

Jouni Kerman kerman@stat.columbia.edu http://www.stat.columbia.edu/~kerman

References

Kerman, Jouni and Gelman, Andrew. Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Technical report, Columbia University, New York.

Examples

  rvbern(10, prob=0.5)
  rvbinom(10, size=1, prob=0.5) # Equivalent

[Package rv version 0.925 Index]