New in Wolfram
Mathematica
8: Nonparametric, Derived, and Formula Distributions
◄
previous
|
next
►
Core Algorithms
Use Nonparametric Distributions to Simulate Natural Processes
A data-based distribution created using Old Faithful geyser data. Here one visualizes the PDF and a random sample drawn from the distribution.
In[1]:=
X
data = ExampleData[{"Statistics", "OldFaithful"}];
In[2]:=
X
\[ScriptCapitalD] = KernelMixtureDistribution[data, "SheatherJones"];
In[3]:=
X
p2 = ListPlot[rng = RandomVariate[\[ScriptCapitalD], 500], PlotRange -> {{1, 6}, {30, 110}}, AspectRatio -> 1, Frame -> True, ImageSize -> 220, PlotStyle -> Blue, PlotLabel -> Text[Style["Simulated Eruptions", FontFamily -> "Verdana", Bold]], Background -> Directive[Opacity[.5], White], Axes -> None]; p1 = Plot3D[ Evaluate[PDF[\[ScriptCapitalD], {x, y}]], {x, 1, 6}, {y, 30, 105}, Mesh -> 25, PlotRange -> All, PlotLabel -> Text[Style["Duration vs. Waiting Time", FontFamily -> "Verdana", Large]], BoxRatios -> 1, PlotPoints -> 100, MeshStyle -> Opacity[.3], ColorFunction -> "TemperatureMap", Boxed -> False, ViewPoint -> {2, -2, 1}, Epilog -> Inset[p2, {Right, Bottom}, {Right, Bottom}], ImageSize -> 570]
Out[3]=