# Finding the optimal probabilty distribution

I am trying to obtain the optimal probability distribution function to the following data.

My attempt:

data = Import["data_prob_new.dat", "Table"];
P00 = Histogram[Flatten[data], Automatic, "Probability",
ChartStyle -> Gray, ChartBaseStyle -> EdgeForm[None],
ImageSize -> 500]
fit = FindDistributionParameters[Flatten[data],
LaplaceDistribution[a, b]];
a0 = a /. fit[[1]];
b0 = b /. fit[[2]];
lim = 1000;
t0 = Plot[PDF[LaplaceDistribution[a0, b0], x], {x, a0, lim},
PlotStyle -> {Blue, Thick}, PlotRange -> All];
P0 = Show[{P00, t0}, Frame -> True, Axes -> False,
FrameStyle -> Thick, PlotRange -> {{0, All}, {-0.001, All}},
PlotRangePadding -> 0, PlotRangeClipping -> True]


As we can see, the Laplace probability distribution fails to smoothly fit the tail of the histogram. My question: How can we obtain the best fit (type of distribution) for this histogram?

• The data are not distributed Laplace.
– Alan
Commented Nov 3, 2018 at 12:07
• Gamma distribution might be better Commented Nov 3, 2018 at 12:46
• Try using the EstimatedDistribution function, with a range of PDFs. Looks a bit like the exponential distribution to me. Commented Nov 3, 2018 at 15:21
• There is no "optimal" because you haven't stated what kind of process generated the data. You just have data for which you'd like a reasonable and more compact description such as "Exponential distribution with parameter $\lambda$". Also, you want "PDF" rather than "Probability" to make the histogram and probability density match in scale.
– JimB
Commented Nov 3, 2018 at 16:51
• "no good" ???? See answer below.
– JimB
Commented Nov 3, 2018 at 17:49

Given that you just have data and an urge to fit a parametric probability distribution, the quality of the fit is in the eye of the beholder. Here's the fit with the gamma distribution (suggested by @mikado) (which I think you'll be hard-pressed to find a better fit):

P00 = Histogram[data, Automatic, "PDF", ChartStyle -> Gray,
ChartBaseStyle -> EdgeForm[None], ImageSize -> 500,
PlotRange -> All];
fit = FindDistributionParameters[data,

• Just a comment: Inside the Histogram[...] you changed the option from "Probability" to "PDF". Why? What if we want to plot probability instead of PDF and find the best fit of it? Commented Nov 3, 2018 at 21:24
• You were estimating the parameters of a probability distribution function (pdf) and using the PDF function to display the probability distribution function. For a histogram to match scales, you need the "PDF" option. About the second question I answer with a question: Why would you want a probability scale that's associated with an arbitrary sample size and arbitrary layout of the bins?