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

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

function [pdf] = extstir1l_pdf(n, k, theta, tau)

%persistent coef logtheta

% Initializations.
%if(isempty(coef))
    %coef = factorial(k) * (1-theta)^tau / (-log(1-theta))^k;
    coef = (gammaln(k+1) + tau*log(1-theta) - k*log(-log(1-theta)));
    logtheta = log(theta);
%end

% Evaluate PDF.

%pdf = carlitz1(n,k,tau) * coef * theta^n / factorial(n);
pdf = exp(log(carlitz1(n,k,tau)) + coef + n*logtheta - gammaln(n+1));

return

Contact us