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

poisbet_pdf(n, phi, a, b)
% poisbet_pdf.m - evaluates a Poisson Beta Mix Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, 2005, p.368.    
%
%  Created by Jim Huntley,  8/17/07
%

function [pdf] = poisbet_pdf(n, phi, a, b)

%persistent logp

%if(isempty(logp))
    logp = log(phi);
%end;

prod1 = 1;
for jp = 1:n
    prod1 = prod1 * (a+jp-1) / (a+b+jp-1);
end
pdf = exp(log(prod1) + n*logp + log(genHyper(a+n,a+b+n,-phi)) - gammaln(n+1));

return

Contact us