Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

James Huntley (view profile)

 

generates random variates from over 870 univariate distributions

poisgengam_int_pdf(n, a, b, t, p)
% poisgengam_int_pdf.m - evaluates a discrete a Poisson Generalized Gamma Probability Density.
%   See "Laplace Transforms, Mellin Transforms and Mixed Poisson Processes", 
%   P. Albrecht, Scand. Actuarial J., vol.1, p.58, 1984 and
%
%  Created by Jim Huntley,  05/27/09
%

function [pdf] = poisgengam_int_pdf(n, a, b, t, p)

%persistent coef

%if(isempty(coef))
    coef = -gammaln(p/a);
%end
kmax = 40;

sumk = 0;
for jk = 1:kmax+1
    k = jk - 1;
    sumk = sumk + (-t)^k * b^(-(n+k)/a) * exp(gammaln((n+p+k)/a) ... 
    - gammaln(jk));
end 
pdf = exp(coef * n*log(t) + log(sumk) - gammaln(n+1));

return

Contact us