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

pebl_pdf(n, omega)
% pebl_pdf.m - evaluates a Poisson Exponential Binomial Limit Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, 2005, p.509.    
%
%  Created by Jim Huntley,  8/21/07
%

function [pdf] = pebl_pdf(n, omega)

%persistent coef jmax lomega

%if(isempty(coef))
    coef = exp(-omega) / (omega + 1);
    jmax = max(20,fix(omega/10)*20);
    lomega = log(omega);
%end

sumj = 0;
for jj = n+1:jmax+1
    j = jj-1;
    sumj = sumj + exp(j*lomega - gammaln(j+1));
end
pdf = coef * sumj;

return

Contact us