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

mixpois_pdf(n,lambda,mu,bet)
% mixpois_pdf.m - evaluates a Sichel Mixed Poisson Density.
%   See "Mixed Compound Poisson Distributions", G. Wilmot,   
%   Astin Bulletin, No.16, p. S59. 
%
%  Created by Jim Huntley,  06/06/11
%

function [pdf] = mixpois_pdf(n,lambda,mu,bet)

%persistent logmu lrtbet argmb lcoef

%if(isempty(logmu))
    logmu = log(mu);
    mudbet = mu / bet;
    rtbet = sqrt(1+2*bet);
    lrtbet = log(rtbet);
    argmb = mudbet * rtbet;
    lcoef = log(1 / besselk(lambda,mudbet));
%end

pdf = exp(lcoef + n*logmu + log(besselk(n+lambda,argmb)) - (n+lambda)*lrtbet - gammaln(n+1));

return

Contact us