Normal distribution problem using histfit

9 visualizaciones (últimos 30 días)
Vlatko Milic
Vlatko Milic el 17 de Mayo de 2018
Comentada: Vlatko Milic el 17 de Mayo de 2018
Hi MatLab-friends,
I have a question about histfit. My dataset only contains positive (or 0s) values but when I make my histfit, the normal distribution goes from negative values. How can I make the distribution line only consider positive values?
Attaching figure. How I want the distribution to look is seen with the black line.
Thank you in advance.
P.S.
The code I use now is:
F=d_f_t(:,2) %
n_d=histfit(F)
  2 comentarios
dpb
dpb el 17 de Mayo de 2018
The distribution you drew doesn't represent the data well at all; the normal is a very bad choice being symmetric and unbounded; for a continuous distribution you might try lognormal.
Vlatko Milic
Vlatko Milic el 17 de Mayo de 2018
Thank you very much, you are correct!

Iniciar sesión para comentar.

Respuesta aceptada

the cyclist
the cyclist el 17 de Mayo de 2018
If @dpb had made his comment as an answer, I would have upvoted it.
Your data are clearly not normally distributed. Is there a particular reason that you wanted to fit them with a normal?
You can use the histfit function with a different underlying distribution. dpb's suggestion of a lognormal looks like an excellent choice, from a purely empirical point of view (but you may know something about the underlying process that makes some other distribution a better choice). See the documentation for details, but for example ...
n_d = histfit(F,[ ],'lognormal')
should give you something much better than you have now.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by