Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates


James Huntley (view profile)


generates random variates from over 870 univariate distributions

dblgam_pdf(x, gam, mu, bet)
% dblgam_pdf.m - compute Double Gamma Probaility Density Function.
%    See "Dataplot Reference Manual, DGACDF, Aux-127, NIST, 3/25/97. 
%  Created by:  Jim Huntley,  08/04/04.

function [pdf] = dblgam_pdf(x, gam, mu, bet)

%persistent lb gamlng

    lb = log(bet);
    gamlng = gammaln(gam);

arg = abs(x-mu)/bet;
%pdf = 0.5*arg^(gam-1)*exp(-arg)/(bet*gamma(gam));
pdf = exp(log(0.5*arg^(gam-1)) + (-arg) - (lb + gamlng));


Contact us