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

ext1ev_pdf(x, rho, mu, p)
% ext1ev_pdf.m - evaluates an Extended Type I Extreme Value Probability Density.
%   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 [pdf] = ext1ev_pdf(x, rho, mu, p)

%persistent expmrho coef

% Intializations.
%if(isempty(coef))
    expmrho = exp(-rho);
    coef = rho / (mu * (1-expmrho));
%end

arg = x/ mu;

% Compute PDF.
sum1 = 0;
for jr = 1:p
    %sum1 = sum1 + arg^(jr-1) / factorial(jr-1);
    sum1 = sum1 + exp((jr-1)*log(arg) - gammaln(jr));
end
G = exp(-rho*exp(-arg)*sum1);
sum2 = 0;
for jr = 2:p
    %sum2 = sum2 + arg^(jr-2) / factorial(jr-2);
    sum2 = sum2 + exp((jr-2)*log(arg) - gammaln(jr-1));
end
pdf = G * coef * exp(-arg) * (sum1 - sum2);

return

Contact us