Learn R Programming

MixtureInf (version 1.1)

rmix.exp: generate a random sample from a mixture of exponentials

Description

Generate a random sample from a mixture of exponentials.

Usage

rmix.exp(n, alpha, theta)

Arguments

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

Value

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

See Also

emtest.exp, plotmix.exp, pmle.exp

Examples

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

Run the code above in your browser using DataLab