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

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

function [pdf] = rectbint_pdf(n, nn, p, m)

q = 1 - p;

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) * binomial_coef(m*n,n-r-1) * p^(n-r-1) * q^(m*n-n+r+1);
    end
    pdf = sumr / (nn*n); 
end

return

Contact us