Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rweibullmix

Simulate from Mixtures of Weibull distributions


Description

Simulate from a mixture of univariate Weibull distributions.

Usage

rweibullmix(n, lambda = 1, shape = 1, scale = 1)

Arguments

n

Number of cases to simulate.

lambda

Vector of mixture probabilities, with length equal to m, the desired number of components (subpopulations). This is assumed to sum to 1.

shape

Vector of component shapes.

scale

Vector of component scales.

Value

rexpmix returns an n-vector sampled from an m-component mixture of univariate Weibull distributions.

See Also

rnormmix and rmvnormmix for Gaussian mixtures, rexpmix for mixture of exponentials.

Examples

n = 500 # sample size
m = 2 # nb components
lambda=c(0.4, 0.6)
shape <- c(0.5,5); scale <- c(1,20) # model parameters
set.seed(321)
x <- rweibullmix(n, lambda, shape, scale) # iid ~ weibull mixture

## histogram of the simulated data.
hist(x, col=8)

mixtools

Tools for Analyzing Finite Mixture Models

v1.2.0
GPL (>= 2)
Authors
Derek Young [aut, cre] (<https://orcid.org/0000-0002-3048-3803>), Tatiana Benaglia [aut], Didier Chauveau [aut], David Hunter [aut], Ryan Elmore [ctb], Thomas Hettmansperger [ctb], Hoben Thomas [ctb], Fengjuan Xuan [ctb]
Initial release
2020-02-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.