New in Wolfram
Mathematica
8: Parameter Estimation and Testing
◄
previous
|
next
►
Core Algorithms
Test for Goodness-of-Fit to Any Distribution or Dataset
Visually compare adaptive kernel density estimates to parametric distributions and assess the fit with any one of over a dozen goodness-of-fit tests.
In[1]:=
X
d = NormalDistribution; dat = BlockRandom[SeedRandom[2]; RandomVariate[\[ScriptD] = MixtureDistribution[Join[{1/2}, Table[2^(1 - i)/31, {i, -2, 2}]], Join[{d[]}, Table[d[i + 1/2, 1/(2^i*10)], {i, -2, 2}]]], 10^4]];
In[2]:=
X
p1 = Plot[Evaluate[PDF[\[ScriptD], x]], {x, -4, 4}, PlotRange -> All, Filling -> Axis, Axes -> {True, False}]; p2 = SmoothHistogram[dat, {"Adaptive", Automatic, .5}, Axes -> {True, False}, PerformanceGoal -> "Quality", PlotStyle -> Black]; p3 = DistributionFitTest[dat, \[ScriptD], {"TestDataTable", All}]; data = BlockRandom[SeedRandom[9]; RandomVariate[MultivariateTDistribution[IdentityMatrix[2], 20], 50]];
In[3]:=
X
p5 = DistributionFitTest[data, Automatic, {"TestDataTable", All}]; p4 = SmoothHistogram3D[data, {"Adaptive", Automatic, .25}, PlotRange -> All, ColorFunction -> "LakeColors", Axes -> {True, False, False}, ImageSize -> 250, Boxed -> False, BoxRatios -> {1, 1, 2/3}, PerformanceGoal -> "Quality"];
In[4]:=
X
Grid[{{Show[p1, p2, ImageSize -> 250], p3}, {p5, p4}}, Spacings -> {0, 0}]
Out[4]=