Learn R Programming

MixtureInf (version 1.1)

rmix.pois: generate a random sample from a mixture of Possions

Description

Generate a random sample from a mixture of Possions.

Usage

rmix.pois(n, alpha, theta)

Arguments

n
sample size.
alpha
vector of mixture proportions of length m, the order of the mixture.
theta
vector of parameters of each component.

Value

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

See Also

rmix.binom, rmix.exp, rmix.norm

Examples

Run this code
#generate a random sample from a 2 component Poisson mixture,
#and compute the sample mean and variance.
x <- rmix.pois(200,c(0.3,0.7),c(2,5))
mean(x)
var(x)

Run the code above in your browser using DataLab