2
$\begingroup$

I have the random variable $X\sim0.5Normal[2,2]+0.5Normal[20,2]$ and I am trying to use Mathematica to simulate, say, 500 points from this distribution. I briefly looked into Monte Carlo Simulation online, but I think they only use examples where the distribution is a "well-known" (i.e. Normal, Beta, etc.).

$\endgroup$
3
$\begingroup$
RandomVariate[
 MixtureDistribution[{.5, .5}, 
 NormalDistribution @@@ {{2, 2},{20, 2}}], 
 500]

Histogram[%, 30]

enter image description here

$\endgroup$
  • $\begingroup$ Wow thank you so much!!! $\endgroup$ – J. Campos Jun 12 '17 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.