mixgen: Generating Mixture Datasets

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/pcensmix.R

Description

This function generates two-component mixture data from a various different mixture distributions.

Usage

1
mixgen(N, dist1, dist2, control)

Arguments

N

population size.

dist1, dist2

respective distributions of the first and second mixture components to be simulated from. For Normal, Log-normal, Weibull, Gamma, Cauchy and Beta distributions, they must be provided as 'norm', 'lnorm', 'weibull', 'gamma', 'cauchy' and 'beta' respectively. The Exponential distribution can be included as a Gamma distribution with scale parameter one.

control

a list of parameters for controlling the simulation process. This includes parameters of the first and second mixture component distributions and the mixture proportion π which should be provided in the order mentioned, i.e., parameters for the first component come first, those of the second component come after and then the value of the mixing proportion. All values should be provided in a list of numerics. Note parameters for each component distribution should be added in the order as required in their generator functions, see rnorm, rlnorm, rweibull, rgamma, rcauchy and rbeta.

Details

It generates a two-component mixture dataset from a density function

π f_1 + (1 - π) f_2,

where f_1 and f_2 are the first and the second mixture component distributions respectively.

Value

An object of class data.frame containing the following information:

z

mixture data

label

component indicator

Author(s)

Lida Fallah, John Hinde

Maintainer: Lida Fallah <l.fallah22@gmail.com>

See Also

pcgen

Examples

1
2
3
4
5
## Generate a sample from a two component Normal-Weibull mixture distribution
## with mixing components as N(12, 2) and Weibull(15, 4), mixing proportion 0.3
## and size of N = 20.

mixture<- mixgen(N = 20, dist1 = 'norm', dist2 = 'weibull', control = list(12, 2, 15, 4, 0.3))

pcensmix documentation built on May 2, 2019, 1:10 p.m.