When does the kernel fitdist function returns nan?

2 views (last 30 days)
Dear all,
I am using the fitdist function in my code and notice that for some inputs I have a vector with nan entries.
This is the way I implement the code: pdf_x = fitdist(x,'Kernel','Kernel','epanechnikov');
So I wonder why? When does the a fitdistr kernel code return missing vallues? Can I have some feedback on this point?
thank you in advance.
Clarisha
I have the impression that it return a vector with missing values. Is that possible, pdLong = fitdist(NoAddLong,'Kernel','Kernel','epanechnikov');
  2 Comments
the cyclist
the cyclist on 24 Dec 2018
Can you upload MAT file with an example of the vector x that exhibits this behavior?
Clarisha Nijman
Clarisha Nijman on 25 Dec 2018
Edited: madhan ravi on 25 Dec 2018
Finally I was able to find one of the problematic situation: sum(f) equals zero, such that I cannot devide by zero. The sum of that probability distribution vector should equal one. So the question is now, why do I get a zero vector for pdf?
The code reads partially:
x=[0.294117647058824;0.352941176470588;0.529411764705882;0.588235294117647;0.588235294117647;0.470588235294118;0.588235294117647;0.529411764705882;0.125000000000000;0.375000000000000;0.562500000000000;0.625000000000000;0.625000000000000;0.500000000000000;0.125000000000000]
M=1000;
U = -M:1:M; %lijst met alle overgangen
NoAdd=x;
pd = fitdist(x,'Kernel','Kernel','epanechnikov');
f = pdf(pd,U);
prob=f/sum(f);

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!