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

genlagkatz_pdf(n, bet, b, c)
% genlagkatz_pdf.m - evaluates a Generalized Lagrangian Katz Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp & Kotz,
%   J. Wiley, 2005, 331. 
%
%  Created by Jim Huntley,  04/01/08
%

function [pdf] = genlagkatz_pdf(n, bet, b, c)

%persistent logbet logomb h

%if(isempty(logbet))
    logbet = log(bet);
    logomb = log(1-bet);
    h = b / bet;
%end

pdf = c * exp(log(binomial_coef(c+h*n+n,n)+eps) + n*logbet + ...
             (c+h*n)*logomb - log(n+h*n+c));                % Gen. Katz; Bazargan-Lari (2) 
  
return

Contact us