Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates



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

    ltheta = log(theta);
    coef = -log(exp(theta)-1);

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


Contact us