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

betaprod_pdf(x, a, b, lambda, bet)
% betaprod_pdf.m - evaluates a Beta Product Probability Density.
%   See "On the Product and Ratio of Gamma and Beta Random Variables", 
%   S. Nadrajah & S. Kotz, Allgemeines Statistisches Archiv 89, 435, 11/05. 
%
%               Vector Form of PDF !!!
%
%  Created by Jim Huntley,  09/26/08
%

function [pdf] = betaprod_pdf(x, a, b, lambda, bet)

%persistent coef
    coef =  exp(bet*log(lambda) + gammaln(b) - (gammaln(bet)+betaln(a,b)));
%if(isempty(coef))
    
%end

for jx = 1:size(x,2)
    arg = lambda * x(jx);
    U = KummerU(b,1+bet-a,arg);
    pdf(jx) = coef * x(jx)^(bet-1) * exp(-arg) * U;
end

return


Contact us