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

gengam5p_pdf(x, t1, t2, t3, t4)
% gengam5p_pdf.m - evaluatess a Generalized Gamma 5-Parameter Probability Density.
%   See "Continuous Univariate Distributions", Johnson, Kotz & Balakrishnan,
%   Vol. 2, J. Wiley, 1995, p.649.
%
%       Note:  Choose t1 -> t4 small and alternating sign to prevent overflow!!!
%
%       Vector form of PDF!!!
%
%  Created by Jim Huntley,  10/21/08
%

function[pdf] = gengam5p_pdf(x, t1, t2, t3, t4)

%persistent eta

%if(isempty(eta))
    kern = exp(t1.*log(x) + t2.*x + t3.*x.^2 + t4.*x.^3);
    eta = log(simps(x,kern));
%end

pdf = exp(t1.*log(x) + t2.*x + t3.*x.^2 + t4.*x.^3 - eta);

return



Contact us