# Estimating the shape of the distribution of histogram

Here is the data:

data = {37., 76, 81, 81, 28, 29, 18, 18, 27, 44, 18, 17, 70, 87, 45, 32, 88, 20, 18, 44, 17, 51, 24, 37, 24, 21, 18, 18, 17, 44, 25, 16, 45, 31, 74, 38, 16, 35, 17, 44, 34, 27, 87, 25, 45, 24, 44, 73, 18., 44, 16, 16, 73, 17, 16, 51, 24, 16, 31, 44, 86, 19, 52, 35, 18, 18, 70, 17, 28, 44, 69, 65, 57, 46, 23, 18, 56, 16, 20, 44, 77, 18, 74, 26, 59, 28, 21, 21, 29, 44, 17, 33, 17, 17, 36, 42, 18, 76, 53, 44};

When it is plotted in a histogram, how to find its distribution overlaid on the histogram, and how to estimate the shape of the distribution?

• Are you sampling from a continuous or discrete distribution? In other words, is the measurement an integer or a rounded real number? And is there some theoretical reason to expect a commonly used distribution? This might be a better question for stats.stackexchange.com.
– JimB
Commented Feb 26 at 4:03

\$Version

(* "14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023)" *)

Clear["Global*"]

data = {37., 76, 81, 81, 28, 29, 18, 18, 27, 44, 18, 17, 70, 87, 45,
32, 88, 20, 18, 44, 17, 51, 24, 37, 24, 21, 18, 18, 17, 44, 25, 16,
45, 31, 74, 38, 16, 35, 17, 44, 34, 27, 87, 25, 45, 24, 44, 73,
18., 44, 16, 16, 73, 17, 16, 51, 24, 16, 31, 44, 86, 19, 52, 35,
18, 18, 70, 17, 28, 44, 69, 65, 57, 46, 23, 18, 56, 16, 20, 44, 77,
18, 74, 26, 59, 28, 21, 21, 29, 44, 17, 33, 17, 17, 36, 42, 18,
76, 53, 44};

distr = {HistogramDistribution,
SmoothKernelDistribution,
EstimatedDistribution[#,
HalfNormalDistribution[a]] &,
EstimatedDistribution[#,
RiceDistribution[a, b]] &};

Column[Show[
Histogram[data, Automatic, "PDF"],
Plot[PDF[#[data], x], {x, 0, 100}],
PlotLabel ->
(# /. (EstimatedDistribution[_, d_] &) :> d),
ImageSize -> Medium] & /@ distr]


• @How to know which one describe it the best ? Commented Feb 26 at 5:34
• Use DistributionFitTest; however, that are a multitude of possible distributions that you could use. You should start by analyzing the process that is generating the data to determine what the theoretical distribution should be. Then use EstimatedDistribution` to find the best fit. Commented Feb 26 at 17:55