View source: R/WeibullRMMSEM.R
rweibullmix | R Documentation |
Simulate from a mixture of univariate Weibull distributions.
rweibullmix(n, lambda = 1, shape = 1, scale = 1)
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. |
rexpmix
returns an n-vector sampled from an m-component
mixture of univariate Weibull distributions.
rnormmix
and rmvnormmix
for Gaussian mixtures,
rexpmix
for mixture of exponentials.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.