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

lognegbin_pdf(n, p, m)
% lognegbin_pdf.m - evaluates a Logarithmic Negative Binomial Probability Density.
%   See "Lagrangian Probability Distributions", P.C. Consul & F. Famoye,
%   Birkhauser, 2006, Table 2.4.
%
%  Created by Jim Huntley,  12/04/08
%

function [pdf] = lognegbin_pdf(n, p, m)

%persistent q coef

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

sumk = 0;
for k = 1:n
    sumk = sumk + binomial_coef(m*n+n-k-1,n-k) / k;
end    
pdf =  coef * p^n * q^(m*n-1) * sumk;       

return

Contact us