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

betaprod2_pdf(x, p1, q1, p2, q2)
% betaprod2_pdf.m - evaluates a Beta Product Probability Density.
%   See "Continuous Univariate Distributions", Johnson, Kotz, and
%   Balakrishnan, V2, J. Wiley, , p.258, 1996. 
%
%               Vector Form of PDF !!!
%
%  Created by Jim Huntley,  11/13/06
%

function [pdf] = betaprod2_pdf(x, p1, q1, p2, q2)

%persistent a b c Bstar

%if(isempty(a))
    % Initializations.
    a = q2;
    b = p1-p2+q1;
    c = q1+q2;
    Bstar = exp(gammaln(p1+q1) + gammaln(p2+q2) - (gammaln(p1)+gammaln(p2)+gammaln(q1+q2)));
%end

pdf = Bstar .* x.^(p1-1) .* (1-x).^(q1+q2-1) .* hypergeom([a b],c,1-x);

return


Contact us