# Employ Nonparametric Distributions in Sophisticated Mixture Models

A semi-parametric model for some heavy-tailed data. The tails are truncated Cauchy distributions estimated via maximum likelihood. The body of the model is a nonparametric kernel density estimate of the data.
 In[1]:= Xdata = RandomVariate[CauchyDistribution[0, 1], 10000]; q10 = Quantile[data, .1]; q90 = Quantile[data, .9]; left = EstimatedDistribution[Select[data, # < q10 &], TruncatedDistribution[{-\[Infinity], q10}, CauchyDistribution[a, b]]]; right = EstimatedDistribution[Select[data, # > q90 &], TruncatedDistribution[{q90, \[Infinity]}, CauchyDistribution[a, b]]]; body = TruncatedDistribution[{q10, q90}, SmoothKernelDistribution[Select[data, q10 - 1 <= # <= q90 + 1 &]]];
 In[2]:= X\[ScriptCapitalD] = MixtureDistribution[{.1, .8, .1}, {left, body, right}];
 In[3]:= XFramed[Grid[ Partition[ Table[Plot[f[\[ScriptCapitalD], x], {x, -20, 20}, PlotRange -> All, Exclusions -> None, Axes -> {True, False}, Ticks -> {Range[-20, 20, 10], {}}, PlotLabel -> Style[ToString@f, Bold, FontFamily -> "Verdana"], Filling -> Axis, PlotStyle -> Black, FillingStyle -> (ColorData[35, #] & /@ Flatten[2 Position[{PDF, CDF, SurvivalFunction, HazardFunction}, f] + 1])[[1]], ImageSize -> 270], {f, {PDF, CDF, SurvivalFunction, HazardFunction}}], 2]], RoundingRadius -> 10, FrameMargins -> 10]
 Out[3]=