Learn R Programming

MixtureInf (version 1.1)

rmix.binom: generate a random sample from a mixture of binomials

Description

Generate a random sample from a mixture of binomials.

Usage

rmix.binom(n, alpha, theta, size)

Arguments

n
sample size
alpha
vector of mixture proportions of length m, the order of the mixture.
theta
vector of probabilities of success of component distributions.
size
number of trials.

Value

Return sample of size n from an m-component binomial mixture.

See Also

emtest.binom, plotmix.binom, pmle.binom

Examples

Run this code
#generate a random sample from a 2 component binomial mixture,
#plot the histogram of the data
x <- rmix.binom(200,c(0.3,0.7),c(0.4,0.6),20)
hist(x)

Run the code above in your browser using DataLab