kappa <- 1:3
mu <- 0:2
pmix <- c(0.3, 0.3, 0.4)
x <- 1:10
n <- 10
# mixture densities calculated at each point in x
dwnormmix(x, kappa, mu, pmix)
# number of observations generated from the mixture distribution is n
rwnormmix(n, kappa, mu, pmix)
Run the code above in your browser using DataLab