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

stevens_pdf(n, b, c)
% stevens_pdf.m - evaluates a Stevens Craig (Occupied Cells) Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp & Kotz,
%   J. Wiley, 2005, 4432. 
%
%  Created by Jim Huntley,  7/16/07
%

function [pdf] = stevens_pdf(n, b, c)

%coef = factorial(c) / (c^b);
coef = exp(gammaln(c+1) - (b*log(c)));
%pdf = coef * stirling2(b,n) / factorial(c-n);
pdf = coef * exp(log(stirling2(b,n)+eps) - gammaln(c-n+1));
    
return

Contact us