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

genwar_pdf(n, a, b, alpha)
% genwar_pdf.m - evaluates a Generalized Waring Probability Density.
% "Recursions for Compound Distributions",
%     H. Panjer & G. Wilmot, ASTIN Bull, Vol. 13, No. 1, p. 1.
%
%  Created by Jim Huntley,  02/26/07
%

function [pdf] = genwar_pdf(n, a, b, alpha)

%persistent gbpalph gapb ga gb galph

% Initializations
%if(isempty(ga))
    gbpalph = gammaln(b+alpha);
    gapb = gammaln(a+b);
    ga = gammaln(a);
    gb = gammaln(b);
    galph = gammaln(alpha);
%end

pdf = exp(gammaln(a+n) + gbpalph + gapb + gammaln(alpha+n) - ...
      (gammaln(n+1) + ga + gb + galph + gammaln(a+b+alpha+n)));

return


Contact us