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

ztpois_pdf(n, theta)
% ztpois_pdf.m - evaluates a Zero Truncated Poisson Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp and Kotz, 
%   J. Wiley, p.188, 2005.
%
%  Created by Jim Huntley,  10/23/07
%

function [pdf] = ztpois_pdf(n, theta)

%persistent coef ltheta

%if(isempty(coef))
    ltheta = log(theta);
    coef = -log(exp(theta)-1);
%end

pdf = exp(coef + n*ltheta - gammaln(n+1));

return

Contact us