# How to determine, calculate and plot a probability distribution for a given set of numbers?

A device is rotating with a particular wind speed and producing such pulse frequencies in a minute:

24.988 25.224 25.212 25.066 25.310 24.963 24.826 24.944 25.490 25.176 24.740 24.988
24.994 24.722 24.510 24.863 25.249 24.931 25.218 24.907 25.459 25.292 25.163 25.447
25.072 25.360 24.976 25.103 25.237 24.845 25.237 25.206 25.109 24.969 24.976 25.194
25.218 24.975 24.777 24.832 24.564 24.637 24.919 24.931 24.944 24.994 25.378 25.042
25.182 25.151 25.097 25.103 25.030 25.018 24.783 24.722 24.667 24.963


Is it possible to understand what type of distribution is this and plot it? Each number is the average of frequency for a second.

Each number is the mean pulse frequency for 1 second in Hz. So I want to see how are these frequencies distributed.

• fine fine,let us wait others to asnwer – dato datuashvili Jan 14 '14 at 15:27
• Try calculating a histogram of the data. If the random process that you're drawing the data from is stationary, then as the number of samples that you put into the histogram gets large, then its shape should approach the pdf of the underlying probability distribution. Note that if you're generating the above values by summing up many individual observations, then the samples could begin to appear Gaussian due to the central limit theorem. – Jason R Jan 14 '14 at 16:10

In Matlab that would look like the code below

Since your data set is very small, it'll be difficult to get an accurate estimation of the PDF. The more data you have, the better your estimate can get and the smaller you can make the intervals. To get the actual PDF you'd have to normalize to the interval width.

%% data
x = [24.988 25.224 25.212 25.066 25.310 24.963 24.826 24.944 25.490 25.176 24.740 24.988   ...
24.994 24.722 24.510 24.863 25.249 24.931 25.218 24.907 25.459 25.292 25.163 25.447 ...
25.072 25.360 24.976 25.103 25.237 24.845 25.237 25.206 25.109 24.969 24.976 25.194 ...
25.218 24.975 24.777 24.832 24.564 24.637 24.919 24.931 24.944 24.994 25.378 25.042...
25.182 25.151 25.097 25.103 25.030 25.018 24.783 24.722 24.667 24.963    ];

% create sum suitable bins
bins = 24.5:.1:25.4;
[count, intervals ] = hist(x,10); % 10 intervals;
clf;
bar(intervals, count);
grid('on');

• thanks for this. by the way I have the data of all frequencies not only the mean. The number of all frequencies is 2500 (number of data). Based on your MATLAB code could you give me a hint about the intervals and bins that I dont know how to obtain bins and interval for a data set. – user16307 Jan 14 '14 at 20:59
• In this answer's code the bins variable is not used. Instead, the bin centers are determined by the hist() function. – applesoup Jan 29 '17 at 12:16

A kernel density estimation based on your data: Depend on your programming language, you may find the corresponding fitting functions with different distributions.

EDIT

I tried to use the allfitdist function with statistic toolbox in Matlab in your data fitting.

x = [24.988 25.224 25.212 25.066 25.310 24.963 24.826 24.944 25.490 25.176 24.740 24.988   ...
24.994 24.722 24.510 24.863 25.249 24.931 25.218 24.907 25.459 25.292 25.163 25.447 ...
25.072 25.360 24.976 25.103 25.237 24.845 25.237 25.206 25.109 24.969 24.976 25.194 ...
25.218 24.975 24.777 24.832 24.564 24.637 24.919 24.931 24.944 24.994 25.378 25.042...
25.182 25.151 25.097 25.103 25.030 25.018 24.783 24.722 24.667 24.963    ];

[D PD] = allfitdist(x,'PDF');


Unfortunately the fitted probability density is not good enough: The curves for each possible distribution are all overlapped. Like I mentioned yesterday, you may need more sample number to obtain a better estimation.

• thanks for the plot. does that mean the longer the data acquisition for pulses(the more mean frequency data) the more accurate the measurement is since it looks like Gaussian shape? – user16307 Jan 14 '14 at 20:45
• The more number you obtain, the more accurate to estimate the probability. – lennon310 Jan 14 '14 at 20:49
• @user16307 I updated my answer, for your reference. Thanks – lennon310 Jan 15 '14 at 19:39

Yes, just plot a histogram. If you have MATLAB, you can then use trapz to convert the count in each bin to a probability. Play around with the number of bins until you get something that looks reasonable. It should be noted, that you may not have enough data for a good representation of the PDF.