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

simon_pdf(n, alpha)
% simon_pdf.m - evaluates a Simon Probability Density.
%   "Re-inventing Willis", M. Simkin and V. Roychowdhury, UCLA
%
%  Created by Jim Huntley,  03/02/07
%

function [pdf] = simon_pdf(n, alpha)

%persistent gamln1 l1malp

%if(isempty(gamln1))
    gamln1 = gammaln(1 + 1/(1-alpha));
    l1malp = log(1-alpha);
%end

%pdf = gamma(n) * gamma(1 + 1/(1-alpha)) / (gamma(n+1+(1/(1-alpha))) * (1-alpha));
pdf = exp(gammaln(n) + gamln1 - gammaln(n+1+(1/(1-alpha))) - l1malp);

return


Contact us