Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

 

generates random variates from over 870 univariate distributions

poispear6_int_pdf(n, a, b, t, c, d, nmax)
% poispear6_int_pdf.m - evaluates a Poisson Pearson V Probability Density.
%   See "Laplace Transforms, Mellin Transforms and Mixed Poisson Processes", 
%   P. Albrecht, Scand. Actuarial J., vol.1, p.58, 1984. 
%
%  Created by Jim Huntley,  07/09/09
%

function [pdf] = poispear6_int_pdf(n, a, b, t, c, d, nmax)

%^persistent coef z logdt kterm

%if(isempty(coef))
    coef = exp(-d*t) / beta(a,b-a);
    z = (d-c) * t;
    logdt = log(d*t);
    %Pre-Compute and store k-dependent terms.
    for jk = 1:nmax+1
        k = jk - 1;
        kterm(jk) = (-1)^k * ((c-d)/d)^k * gamma(b-a+k) * ...
                    real(KummerU(b-a+k,1-a+k,z));               
    end
%end

sumk = 0;
for jk = 1:n+1
    k = jk - 1;
    sumk = sumk + binomial_coef(n,k) * kterm(jk);                
end
pdf = coef * exp(n*logdt + log(sumk) - gammaln(n+1));

return

Contact us