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

Description Usage Arguments Value Author(s) See Also Examples

Description

Generate a random sample from a mixture of exponentials.

Usage

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

Author(s)

Shaoting Li, Jiahua Chen and Pengfei Li

See Also

emtest.exp, plotmix.exp, pmle.exp

Examples

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

Example output

[1] 5.605544
[1] 46.04636

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