Normalising histogram with certain pdf

9 次查看(过去 30 天)
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.

回答(1 个)

the cyclist
the cyclist 2015-11-26
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 个评论
Image Analyst
Image Analyst 2015-11-27
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 2015-11-27
编辑:Martynas Subonis 2015-11-27
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Histograms 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by