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

extstir2c_pdf(n, k, m, tau)
% extstir2c_pdf.m - evaluates an Extended Stiling 2C Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp & Kotz,
%   J. Wiley, p.323, 2005. 
%
%  Created by Jim Huntley,  01/09/07
%

function [pdf] = extstir2c_pdf(n, k, m, tau)

%persistent coef logmpt

% Initializations.
%if(isempty(coef))
    %coef = factorial(m);
    coef = gammaln(m+1);
    logmpt = log(m+tau);
%end

% Evaluate PDF.

%pdf = carlitz2(n-1,n-k,tau) * (n-k+tau) * coef / (factorial(m-n+k) * (m+tau)^n);
pdf = exp(log(carlitz2(n-1,n-k,tau)) + log(n-k+tau) + coef - (gammaln(m-n+k+1) + n*logmpt));

return

Contact us