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

bingengam_pdf(nh,nn,a,b,c,p)
% bingengam_pdf.m - evaluates a Compound Binomial Generalized Gamma Probability Density.
%   See "The Compounding of the Binomial and Generalized Beta Distributions",   
%   T. Gerstenkorn, Prob. and Statistical Inference, p.87, 1982. 
%
%   NORMALIZATION PUTS A COMPLICATED UPPER LIMIT ON 'c'.
%
%  Created by Jim Huntley,  06/08/11
%

function [pdf] = bingengam_pdf(nh,nn,a,b,c,p)

for jn = 1:size(nh,2) 
    sumk = 0;
    n = nh(jn);
    gampda = gamma(p/a);
    bcnndx = binomial_coef(nn,n);
    for jk = 1:nn-n
        k = jk - 1;
        sumk = sumk + binomial_coef(nn-n,k) * (-1)^k * (b*c^a)^((n+k)/a) * ...
               gamma((p+n+k)/a);
    end
    pdf(jn) = sumk * bcnndx / gampda;
end

return

Contact us