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

logpoist_pdf(n, p, lambda)
% logpoist_pdf.m - evaluates a Logarithmic Poisson (Transformed) Probability Density.
%   See "Lagrangian Probability Distributions", P.C. Consul & F. Famoye,
%   Birkhauser, 2006, Table 2.3.
%
%  Created by Jim Huntley,  11/17/08
%

function [pdf] = logpoist_pdf(n, p, lambda)

%persistent q coef

%if(isempty(coef))
    q = 1 - p;
    coef = log(p / (-log(q)));
%end

%pdf = coef * (n*lambda)^(n-1) * exp(-lambda*n) * ...
%      hypergeom([1-n,1],[],-p/(lambda*n)) / gamma(n+1);
pdf = exp(coef + (n-1)*log(n*lambda) - lambda*n + ...
      log(genHyper([1-n,1],[],-p/(lambda*n))) - gammaln(n+1));          

end

Contact us