Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

James Huntley (view profile)

 

generates random variates from over 870 univariate distributions

ext1ev_cdf(x, rho, mu, p)
% ext1ev_cdf.m - evaluates an Extended Type I Extreme Value Cumulative Distribution.
%   See "Continuous Univariate Distributions", Vol. 2, Johnson, Kotz, and
%   Balakrishnan, Wiley, 1995.
%   Modified for positive arguments only (see jmh notes)!!!
%
%   Created by: J. Huntley,  01/09/07
%  

function [cdf] = ext1ev_cdf(x, rho, mu, p) 

% Compute CDF.
arg = x / mu;
sum1 = 0;
for jr = 1:p
    %sum1 = sum1 + arg^(jr-1) / factorial(jr-1);
    sum1 = sum1 + exp((jr-1)*log(arg+1e-8) - gammaln(jr));
end
cdf = (exp(-rho*exp(-arg)*sum1) - exp(-rho)) / (1 - exp(-rho));

return

Contact us