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?

  • $\begingroup$ See stats.stackexchange.com/questions/243392/… and stats.stackexchange.com/questions/226834/… the procedure is the same in here. $\endgroup$
    – Tim
    Dec 22, 2016 at 9:59
  • $\begingroup$ 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? $\endgroup$
    – whuber
    Dec 22, 2016 at 15:12
  • $\begingroup$ With mixture of normals I actually mean a combination of normal density functions, obtained through a system of weights... $\endgroup$
    – maumag77
    Dec 22, 2016 at 20:34


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.