Problem with ksdensity with Inverse gamma(0.001, 0.001)

1 view (last 30 days)
Hello! I am trying to plot the ksdensity of an Inverse gamma(0.001, 0.001) but the plot has only one point. The commands I used are
alpha1 = 0.001;
beta1 = 0.001;
n = 1e+5;
r=1./gamrnd(alpha1,1/beta1,n,1);
[f,xi] = ksdensity(r);
plot(xi,f,'--m');
The first term of f is a real number and all the others are NaN. The first term of xi is a real number and all the others are Inf.
Could you please me help me with this.
Thank you very much.
  1 Comment
Brendan Hamm
Brendan Hamm on 20 Jul 2015
With these values of alpha and beta almost all weight in the gamma distribution is near zero. Therefore your r values are very likely to be Inf.

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!