0
$\begingroup$

I got this list:

list={{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 1}, {6, 2}, {7, 3}, {8, 3}, {9, 8}, {10, 5}, {11, 7}, {12, 23}, {13, 11}, {14, 8}, {15, 10}, {16, 2}, {17, 2}, {18, 0}, {19, 1}, {20, 0}, {21, 1}}

I split this list in two:

listsize = Table[Part[list, i, 1], {i, 1, 22}];
listfreq = Table[Part[list, i, 2], {i, 1, 22}];

I used the WeightedData on listsize and listfreq as:

weigthlist=WeightedData[listsize, listfreq]

I used this in aim to use the Mathematica Histogram func as:

hist1=Histogram[weigthlist, 22, "PDF"]

First question, how can I have the same histogram without weighting? Second question, and it's the most important, how can I fit my histogram with the good distribution (Gaussian, Cauchy, etc.)? I read many answer but none of them helped me.

$\endgroup$
  • 2
    $\begingroup$ You can recreate weighted data also by using WeightedData[list[[All,1]], list[[All,2]]] or even WeightedData@@Transpose[list]. You can reconstruct a set of observations and plot the histogram with Flatten[Table@@@list] // Histogram. Probably you would also want to look at the documentation of FindDistribution (which can be directly applied like Flatten[Table@@@list] // FindDistribution for distribution fitting.) It's interesting that binning differs between these approaches! $\endgroup$ – kirma May 22 at 9:30
  • 1
    $\begingroup$ Thanks Roman, it works very well! $\endgroup$ – AlainP May 22 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.