Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

James Huntley (view profile)

 

generates random variates from over 870 univariate distributions

gaushyp_pdf(x, p, q, r, lambda)
% gaushyp_pdf.m - evaluates the Gaussian Hypergeometric Probability Density Function.  
%                  See "A Generalization of Generalized Beta Distributions", M. B. Gordy, Fed. Res., 4/8/98.
%                  Vector Form!
%
% Created by Jim Huntley,  03/10/05
%

function [pdf] = gaushyp_pdf(x, p, q, r, lambda)

%persistent coef

%if(isempty(coef))
    B = beta(p,q);
    F21 = genHyper([r,p], p+q, -lambda);
    coef = 1 / (B*F21);
%end

for jx = 1:size(x,2)
    pdf(jx) = 0;
    if(x(jx) > 0)              
        pdf(jx) = coef .* (x(jx))^(p-1) * (1-x(jx))^(q-1) * (1+lambda*x(jx))^(-r);
    end
end

return

Contact us