Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates


James Huntley


generates random variates from over 870 univariate distributions

gengam_pdf(x, k, c, a, b)
% gengam_pdf.m - evaluates a Generalized Gamma Probability Density.
%   See "Dataplot Reference Manual, GGDCDF", Aux-206, NIST, 3/25/97.
%  Created by Jim Huntley,  8/03/04

function [pdf] = gengam_pdf(x, k, c, a, b)

%persistent gamk t1 logc

    gamk = gammaln(k);
    t1 = log(b^(c*k));
    logc = log(c);

%pdf = c*(x-a)^(c*k-1)*exp(-((x-a)/b)^c)/(gamma(k)*b^(c*k));
pdf = exp(logc + log((x-a)^(c*k-1)) + (-((x-a)/b)^c) - (gamk + t1));


Contact us