Wolfram
Mathematica
8의 신기능: 매개 변수 확률 분포
◄
이전
|
다음
►
핵심 알고리즘
영어는 단어의 임의의 집합이 아닙니다
영어 단어 길이는 첫번째 그림과 같이
BinomialDistribution
에 따릅니다. 임의의 길이의 단어 모임은 두 번째 그래픽과 같이
WaringYuleDistribution
로 모델링할 수있습니다.
In[1]:=
X
worddata = StringLength /@ DictionaryLookup[{"English", All}];
In[2]:=
X
binom = EstimatedDistribution[worddata, BinomialDistribution[n, p], ParameterEstimator -> {"MaximumLikelihood", Method -> {"FindRoot", MaxIterations -> 1000}}];
In[3]:=
X
randomWordLength = StringLength /@ StringSplit[ StringJoin[ RandomChoice[CharacterRange["a", "z"]~Join~{" "}, 10^6]]];
In[4]:=
X
wyd = EstimatedDistribution[randomWordLength - 1, WaringYuleDistribution[a, b]];
In[5]:=
X
Show[Histogram[worddata, {Range[25] - 1/2}, "ProbabilityDensity", ChartStyle -> "SolarColors", BaseStyle -> {FontFamily -> "Verdana"}, PlotLabel -> "Length of Words in English"], DiscretePlot[PDF[binom, x], {x, 0, 25}, PlotRange -> All, PlotStyle -> Black, PlotMarkers -> {Automatic, Medium}], Epilog -> Inset[Framed[ Style[Grid[{{"Estimated Distribution:"}, {binom}}], 12], Background -> LightBlue, RoundingRadius -> 3], {Right, 0.15}, {Right, Top}], ImageSize -> 400] Show[Histogram[randomWordLength - 1, {0, 120, 10}, "PDF", ChartStyle -> "SolarColors", BaseStyle -> {FontFamily -> "Verdana"}, PlotLabel -> "Length of Words at Random"], DiscretePlot[PDF[wyd, k], {k, 0, 120}, PlotStyle -> Black, PlotMarkers -> {Automatic, Tiny}], Epilog -> Inset[Framed[Style[Grid[{{"Estimated Distribution:"}, {wyd}}], 12], Background -> LightBlue, RoundingRadius -> 3], {Right, 0.03}, {Right, Top}], ImageSize -> 400]
Out[5]=
Out[5]=