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

stirling1_pdf(n, nn, theta)
% Stirling1_pdf.m - evaluates a Stirling Type 1 Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, & Kotz, 
%   J. Wiley, 2005, 321. 
%
%  Created by Jim Huntley,  7/03/07
%

function [pdf] = stirling1_pdf(n, nn, theta)

%persistent logt nloglogt glnnnp1

%if(isempty(logt))
    logt = log(theta);
    nloglogt = nn*log(-log(1-theta));
    glnnnp1 = gammaln(nn+1);
%end

pdf =  exp(glnnnp1 + log(stirling1(n,nn)) + n*logt - ...
               (gammaln(n+1) + nloglogt));
    
return

Contact us