New in Wolfram
Mathematica
8: Nonparametric, Derived, and Formula Distributions
◄
previous
|
next
►
Core Algorithms
Generate a Gallery of Mixture Distributions
Build a
MixtureDistribution
from a family of component distributions.
In[1]:=
X
Gaussian = NormalDistribution[]; SkewedUnimodal = MixtureDistribution[{1/5, 1/5, 3/5}, {NormalDistribution[], NormalDistribution[1/2, 2/3], NormalDistribution[13/12, 5/9]}]; StrongSkew = MixtureDistribution[ConstantArray[1/8, 8], Table[NormalDistribution[3 ((2/3)^i - 1), (2/3)^i], {i, 0, 7}]]; KurtoticUnimodal = MixtureDistribution[{2/3, 1/3}, {NormalDistribution[], NormalDistribution[0, 1/10]}]; Outlier = MixtureDistribution[{1/10, 9/10}, {NormalDistribution[], NormalDistribution[0, 1/10]}]; Bimodal = MixtureDistribution[{1/2, 1/2}, {NormalDistribution[-1, 2/3], NormalDistribution[1, 2/3]}]; SeparatedBimodal = MixtureDistribution[{1/2, 1/2}, {NormalDistribution[-3/2, 1/2], NormalDistribution[3/2, 1/2]}]; SkewedBimodal = MixtureDistribution[{3/4, 1/4}, {NormalDistribution[], NormalDistribution[3/2, 1/3]}]; Trimodal = MixtureDistribution[{9/20, 9/20, 1/10}, {NormalDistribution[-6/5, 3/5], NormalDistribution[6/5, 3/5], NormalDistribution[0, 1/4]}]; Claw = MixtureDistribution[{1/2, 1/10, 1/10, 1/10, 1/10, 1/10}, Join[{NormalDistribution[]}, Table[NormalDistribution[i/2 - 1, 1/10], {i, 0, 4}]]]; DoubleClaw = MixtureDistribution[Join[{49/100, 49/100}, ConstantArray[1/350, 7]], Join[{NormalDistribution[-1, 2/3], NormalDistribution[1, 2/3]}, Table[NormalDistribution[(i - 3)/2, 1/100], {i, 0, 6}]]]; AsymmetricClaw = MixtureDistribution[Join[{1/2}, Table[(2^(1 - i))/31, {i, -2, 2}]], Join[{NormalDistribution[]}, Table[NormalDistribution[i + 1/2, (2^-i)/10], {i, -2, 2}]]]; AsymmetricDoubleClaw = MixtureDistribution[{46/100, 46/100, 1/300, 1/300, 1/300, 7/300, 7/300, 7/300}, Join[Join[Table[NormalDistribution[2 i - 1, 2/3], {i, 0, 1}], Table[NormalDistribution[-i/2, 1/100], {i, 1, 3}]], Table[NormalDistribution[i/2, 7/100], {i, 1, 3}]]]; SmoothComb = MixtureDistribution[Table[(2^(5 - i))/63, {i, 0, 5}], Table[NormalDistribution[(65 - (96 (1/2)^i))/21, (32/63)/2^i], {i, 0, 5}]]; DiscreteComb = MixtureDistribution[{2/7, 2/7, 2/7, 1/21, 1/21, 1/21}, Join[Table[NormalDistribution[(12 i - 15)/7, 2/7], {i, 0, 2}], Table[NormalDistribution[2 i/7, 1/21], {i, 8, 10}]]];
In[2]:=
X
plots = Table[ Plot[PDF[\[ScriptCapitalD], x], {x, -3, 3}, Filling -> Axis, FillingStyle -> Directive[Opacity[0.4], Lighter[ColorData[1, 2], 0.4]], PlotStyle -> ColorData[1, 2], Exclusions -> None, Evaluated -> True, PlotPoints -> 100, PlotRange -> All, AxesOrigin -> {0, 0}, Ticks -> None], {\[ScriptCapitalD], {Gaussian, SkewedUnimodal, StrongSkew, KurtoticUnimodal, Outlier, Bimodal, SeparatedBimodal, SkewedBimodal, Trimodal, Claw, DoubleClaw, AsymmetricClaw, AsymmetricDoubleClaw, SmoothComb, DiscreteComb}}];
In[3]:=
X
Framed[GraphicsGrid[Partition[plots, 3], ImageSize -> 550], RoundingRadius -> 10, FrameStyle -> GrayLevel@0.3, FrameMargins -> 10, Background -> Lighter[Blend[{Blue, Green, Blue}], 0.9]]
Out[3]=