New in Wolfram
Mathematica
8: Nonparametric, Derived, and Formula Distributions
◄
previous
|
next
►
Core Algorithms
Simulate a Derived Distribution
Generate random data from a component mixture distribution, using
RandomVariate
.
In[1]:=
X
dist = MixtureDistribution[{2, 4/3}, {NormalDistribution[], NormalDistribution[2, 1/2]}]; SeedRandom[0]; data = RandomVariate[dist, 10^4];
In[2]:=
X
Framed[Show[ Histogram[data, 20, "ProbabilityDensity", ChartStyle -> "AlpineColors"], Plot[PDF[dist, x], {x, -9, 9}, PlotStyle -> {Thick, Blend[{Black, Red}]}], ImageSize -> 470], RoundingRadius -> 10, FrameStyle -> GrayLevel@0.3, FrameMargins -> 10, ImageSize -> 500, Background -> LightPurple]
Out[2]=