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

laglog_pdf(n, bet, c)
% laglog_pdf.m - evaluates a Lagrangian Logarithimic Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp & Kotz,
%   J. Wiley, 2005, 341. 
%
%  Created by Jim Huntley,  6/26/07
%

function [pdf] = laglog_pdf(n, bet, c)

%persistent logc logomc

%if(isempty(logc))
    logc = log(c);
    logomc = log(1-c);
%end

%pdf = -c^n * (1-c)^(n*(bet-1)) * gamma(bet*n) / ...
%          (gamma(n+1)*gamma(bet*n-n+1)*log(1-c));
pdf = - exp(n*logc + n*(bet-1)*logomc + gammaln(bet*n) - ...
          (gammaln(n+1) + gammaln(bet*n-n+1))) / logomc;    
    
return

Contact us