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

invgamma_pdf(x, alpha, bet)
% invgamma_pdf.m - evaluates an Inverted Gamma Probability Density.
%   See "VTFIT, A Routine for Fitting Homogeneous PDFs", User Documentation,
%   R. Cooke, VPI, July, 1993. 
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  7/22/05
%

function [pdf] = invgamma_pdf(x, alpha, bet)

%persistent gamlnalp alplbet

%if(isempty(gamlnalp))
    gamlnalp = gammaln(alpha);
    alplbet = alpha*log(bet);
%end

%pdf = x.^(-alpha-1) .* exp(-bet./x) ./ (bet^(-alpha) * gamma(alpha));
pdf = exp((-alpha-1).*log(x) - bet./x + alplbet - gamlnalp);

return

Contact us