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

Description Usage Arguments Value Author(s) See Also Examples

Description

Generate a random sample from a mixture of binomials.

Usage

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

Author(s)

Shaoting Li, Jiahua Chen and Pengfei Li

See Also

emtest.binom, plotmix.binom, pmle.binom

Examples

1
2
3
4
#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)

Example output



MixtureInf documentation built on May 2, 2019, 3:32 p.m.