Normalising histogram with certain pdf

12 Ansichten (letzte 30 Tage)
Martynas Subonis
Martynas Subonis am 26 Nov. 2015
Bearbeitet: Martynas Subonis am 27 Nov. 2015
Hello,
At the moment I'm stuck with this problem.
I have done maximum likelihood estimation on my data sets and I have acquired the best alpha and beta parameters for Beta distribution.
I the end, I need to compare how well my Beta distribution compares with histogram of data.
[data_counts_1, bin_edges_1] = histcounts(x(:,2),bin_number);
x(:,2) is the column I need. I change bin_edges to bin_center in order to plot the curve of histogram.
beta_distribution = (1/B)*(t.^(alpha-1)).*((1-t).^(beta-1)); Is my beta distribution (I know I could have used matlab built-in function).
But in order to compare these two graphs, I need to normalize the histogram and it's quite a problem for me. If I try to normalize it as uniform distribution:
prob = data_counts_1/sum(data_counts_1);
plot(bin_centers, prob);
I get the result which does not make sense (it's the attached jpg).
My question is, how can I normalize the histogram as beta distribution?
I tried to find how to fit the histogram with my own distribution function (for example fitting histogram with beta function, where I send my own parameters for it) but I failed to find it.

Antworten (1)

the cyclist
the cyclist am 26 Nov. 2015
Which curve is which? The blue line seems like it might sum to 1, and therefore be properly normalized.
If the brown line is your beta distribution, then you could normalized it in similar fashion as you did with the histogram.
  3 Kommentare
Image Analyst
Image Analyst am 27 Nov. 2015
I'm not buying the assertion that dividing an arbitrary distribution by a scalar is valid only for Normal distributions. Where are you getting that from???
Martynas Subonis
Martynas Subonis am 27 Nov. 2015
Bearbeitet: Martynas Subonis am 27 Nov. 2015
I overthinked a little for this problem when I got these results. What I forgot to do, was to divide my histogram by bin width (so the area under the curve is equal to 1 and get pdf):
It should have been: prob = data_counts_1/sum(data_counts_1); prob = prob/bin_width;
After doing that, I got the needed results (jpg file). With these question I got myself and probably others confused as well.
Anyway, thanks for helping cyclist.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by