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

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

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

%persistent q coef

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

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

return

Contact us