1

I would have to define, in R, a mixture of a number of bivariate normal distributions like that: enter image description here

a strategy would be to define the single pieces of the expressions, for example:

bivn_1 <- mvrnorm(1000, mu = c(0, 0), Sigma = matrix(c(1, 0, 0, 1), 2))
bivn_2 <- mvrnorm(1000, mu = c(.5, .5), Sigma = matrix(c(.4, 0, 0, .4), 2))
....

and then to sum up the pieces with the weights $w_1, w_2.... w_n$

Is there a different and easier strategy?

ilanman
  • 4,503
  • 1
  • 22
  • 46
maumag77
  • 11
  • 2
  • See http://stats.stackexchange.com/questions/243392/generate-sample-data-from-gaussian-mixture-model/243398#243398 and http://stats.stackexchange.com/questions/226834/sampling-from-a-mixture-of-two-gamma-distributions/226837#226837 the procedure is the same in here. – Tim Dec 22 '16 at 09:59
  • This strategy is not quite correct, because it doesn't define a true mixture distribution. (In a true mixture, the numbers of observations from each component will have a multinomial distribution rather than having fixed values.) Could you please clarify, then, what you are trying to accomplish? Do you need to sample from a mixture or do you want to create the kind of combined sample shown in the code? – whuber Dec 22 '16 at 15:12
  • With mixture of normals I actually mean a combination of normal density functions, obtained through a system of weights... – maumag77 Dec 22 '16 at 20:34

0 Answers0