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

invgengam_pdf(x, a, bet, p)
% invgengam_pdf.m - evaluates an Inverse Generalized Gamma Probability Density.
%   See "Continuous Univariate Distributions", v.2, Johnson, Kotz, and Balakrishnan, 
%   J. Wiley, 1995, p.401.
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  6/19/07
%

function [pdf] = invgengam_pdf(x, a, bet, p)

%Initializations.
logaa = log(abs(a));
logb = log(bet);
glp = gammaln(p);
sx = size(x,2);

for jx = 1:sx
    %pdf(jx) = abs(a) * (bet/x(jx))^(a*p+1) * exp(-(bet/x(jx))^a ) / (bet*gamma(p));
    pdf(jx) = exp(logaa + (a*p+1)*log(bet/x(jx)) - (bet/x(jx))^a - logb - glp);
end 

return

Contact us