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

lognegbint_pdf(n, p, k)
% lognegbitn_pdf.m - evaluates a Logarithmic Negative Binomial (Transformed) Probability Density.
%   See "Lagrangian Probability Distributions", P.C. Consul & F. Famoye,
%   Birkhauser, 2006, Table 2.3.
%
%   Won't normalize properly if k*p >~ 1-p!!!
%
%  Created by Jim Huntley,  11/17/08
%

function [pdf] = lognegbint_pdf(n, p, k)

%persistent q c1 coef

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

argn = n*(k+1);
pdf = coef * c1^n * binomial_coef(argn,n) / argn ;          

end

Contact us