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

rectpoist_pdf(n, nn, lambda)
% rectpoist_pdf.m - evaluates a Rectangular Poisson (Transformed) Probability Density.
%   See "Lagrangian Probability Distributions", P.C. Consul & F. Famoye,
%   Birkhauser, 2006, Table 2.3.
%
%  Created by Jim Huntley,  11/20/08
%

function [pdf] = rectpoist_pdf(n, nn, lambda)

pdf = 1 / nn;
if(n > 0)
    sumr = 0;
    a = min(n-1,nn-2);
    for jr = 1:a+1
        r = jr - 1;
        sumr = sumr + (r+1) * exp((n-r-1)*log(lambda*n) - gammaln(n-r));
    end
    pdf = exp(-lambda*n) * sumr / (nn*n); 
end

end

Contact us