New in Wolfram
Mathematica
8: パラメトリック確率分布
◄
previous
|
next
►
コアとなるアルゴリズム
若者の総コレステロール値の安定分布モデル
安定分布を使って,21歳未満の被験者で測定した総コレステロール値(mg/dL)をモデル化することができる.
In[1]:=
X
ftpdir = "ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/nhanes/2007-\ 2008/"; choldata = Import[ftpdir <> "TCHOL_E.xpt", {"LabeledData", {"SEQN", "LBXTC"}}]; demo = Import[ ftpdir <> "DEMO_E.xpt", {"LabeledData", {"SEQN", "RIDAGEYR"}}]; idchol = Cases[Transpose[choldata], {_, _?NumericQ}]; idmatch = Intersection[idchol[[All, 1]], demo[[1]]]; totchol1 = Cases[idchol, {Alternatives @@ idmatch, x_} :> x]; choldemo = Cases[Transpose[demo], {Alternatives @@ idmatch, _}]; idagechol = MapThread[Join[#1, {#2}] &, {choldemo, totchol1}]; youthchol = Cases[idagechol, {id_, age_ /; age <= 20, tchol_} :> tchol];
In[2]:=
X
ydist = EstimatedDistribution[youthchol, StableDistribution[\[Alpha]s, \[Beta]s, \[Mu]s, \[Delta]s]]; \[ScriptCapitalH] = DistributionFitTest[youthchol, ydist, "TestDataTable"];
In[3]:=
X
h1 = Histogram[youthchol, Automatic, "PDF"]; g1 = Plot[PDF[ydist, x], {x, Min[youthchol], Max[youthchol]}, PlotRange -> All, PlotStyle -> {Darker[Red], Thick}];
In[4]:=
X
Row[{Show[h1, g1, PlotLabel -> Column[{"Total Cholesterol Distribution-Age\[LessEqual]20", ydist}, Left, 1], ImageSize -> 320], \[ScriptCapitalH][ "TestDataTable", {"AndersonDarling", "CramerVonMises"}]}, Spacer[5]]
Out[4]=