powered by
Random variables from a mixture of k multivariate normal distributions, each of dimension q.
rmixnorm(n, means, sigmas, weights)
An n x q matrix (or a vector if q=1) containing the generated data.
an integer for the number of samples to be generated.
a q x k matrix (or a vector of length k if q=1) containing the means for each component.
a q x q x k covariance array (or a vector of length k if q=1) for each component.
a vector of length k containing the weights for each component.
Feng Li, Central University of Finance and Economics.
Villani et al 2009.
out <- rmixnorm( n = 1000, means = c(-5, 0, 5), sigmas = c(1, 1, 3), weights = c(0.3, 0.4, 0.3) ) hist(out, breaks = 100, freq = FALSE)
Run the code above in your browser using DataLab