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

eggpol2_pdf(n, lambda, alpha)
% eggpol2_pdf.m - evaluates a Polya Eggenberger Probability Density.
%     "Yield Model for Productivity Optimization of VLSI Memory Chips ...",
%     C. H. Stapper et al., IBM J. Res. Develop., Vol. 24, No. 3, p. 398, May, 1980.
%
%  Created by Jim Huntley,  03/05/07
%

function [pdf] = eggpol2_pdf(n, lambda, alpha)

%persistent gamln logt1

%if(isempty(gamln))
    gamln = gammaln(alpha);
    logt1 = log(1+lambda./alpha);
%end

%pdf = gamma(n + alpha) * (lambda./alpha).^n / (factorial(n) * gamma(alpha) ...
%      * (1+lambda./alpha)^(alpha+n));
%pdf = exp(gammaln(n + alpha) + log((lambda./alpha).^n) - (log(factorial(n)) + gammaln(alpha) ...
%      + log((1+lambda./alpha)^(alpha+n))));
pdf = exp(gammaln(n + alpha) + log((lambda./alpha).^n) - (gammaln(n+1) + gamln ...
      + (alpha+n)*logt1));

return


Contact us