Generate n random numbers, distributed according to a normal mixture.
n
rnorMix(n, obj)
the number of random numbers desired.
an object of class norMix.
norMix
numeric vector of length n.
For a mixture of \(m\), i.e., m.norMix(obj), components, generate the number in each component as multinomial, and then use rnorm for each.
m.norMix(obj)
rnorm
dnorMix for the density, and norMix for the construction and further methods.
dnorMix
# NOT RUN { x <- rnorMix(5000, MW.nm10) hist(x)# you don't see the claw plot(density(x), ylim = c(0,0.6), main = "Estim. and true 'MW.nm10' density") lines(MW.nm10, col = "orange") # }
Run the code above in your browser using DataLab