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

invpolegg_pdf(n, nn, a, b, s)
% invpolegg_pdf.m - evaluates an Inverse Polya Eggenberger Probability Density.
%   See "A Generalized Ploya-Eggenberger Model Generating Various Discrete 
%   Probability Distributions", Indian J. of Stat., v.58, Ser A, Pt.2, p243, 1996.
%
%  Created by Jim Huntley,  08/19/11
%

function [pdf] = invpolegg_pdf(n, nn, a, b, s)

%persistent prodb

%if(isemptyt(prodb))
    prodb = 1;
    for jb = 1:nn
        j = jb - 1;
        prodb = prodb * (b+j*s);
    end
%end

proda = 1;
for ja = 1:n
    j = ja - 1;
    proda = proda * (a+j*s);
end
prodapb = 1;
for jab = 1:n+nn
    j = jab - 1;
    prodapb = prodapb * (a+b+j*s);
end
pdf = binomial_coef(nn+n-1,n) * proda * prodb / prodapb;

return

Contact us