New in Wolfram
Mathematica
8: Parametric Probability Distributions
◄
previous

next
►
Core Algorithms
Stable Distribution Model of Total Cholesterol Level in Youth
Total cholesterol (mg/dL) measured in study participants under the age of 21 can be modeled using a stable distribution.
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 DistributionAge\[LessEqual]20", ydist}, Left, 1], ImageSize > 320], \[ScriptCapitalH][ "TestDataTable", {"AndersonDarling", "CramerVonMises"}]}, Spacer[5]]
Out[4]=