How to fit a histogram plot to a poisson distribution

조회 수: 14 (최근 30일)
Abhik
Abhik 2023년 8월 30일
편집: Torsten 2023년 8월 31일
I have a histogram plot which looks like this. where I have only plotted spacing_ratios = diff(energies) ./ mean(diff(energies)). energies corresponds to the eigenvalues of a particular hamiltonian matrix. I have used the code
edges=linspace(min(spacing_ratios),max(spacing_ratios),300);
h=histogram(spacing_ratios,'BinEdges',edges);
Now I want to fit this histogram plot to poisson distribution such that the probabilty of having n energy levels in a particular interval of energies E and E+deltaE will be
where \lambda is the average number of levels in that interval. How can I fit this with my numerical results shown above?
  댓글 수: 5
Abhik
Abhik 2023년 8월 31일
using poissfit I can not fit the data I also do not know how to scale the histogram plot because what i am getting is the raw data of energy spacing Now I want a plot that describe this raw data with proper scaling so that I can get the unknown parameter of the poisson distribution
Torsten
Torsten 2023년 8월 31일
편집: Torsten 2023년 8월 31일
Your data contain non-integer values - so they cannot follow a Poisson distribution.
To fit a distribution, you usually do not scale the data - you work with the raw data.
To get an empirical distribution curve for your data, use
histogram(spacing_ratios,'Normalization','pdf')

댓글을 달려면 로그인하십시오.

답변 (1개)

Torsten
Torsten 2023년 8월 30일
편집: Torsten 2023년 8월 30일
Simply use
lambdahat = poissfit(spacing_ratios)
But I'm surprised you want to fit data that take non-integer values with a distribution that has only mass on the set of the natural numbers. Isn't that inadequate ?
  댓글 수: 1
the cyclist
the cyclist 2023년 8월 30일
I agree, and frankly I'm surprised that poissfit doesn't give a warning for non-integer input. (Maybe I'm forgetting something.)
Perhaps wblfit is more appropriate (applied to the original data, not the histogrammed data, as @Torsten did in this solution). But, of course, the correct distribution to use depends on the underlying distribution that is theorized to have generated the data.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by