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

generr_pdf(x, nu, mu, sigma)
% generr_pdf.m - evaluates a Generalized Error Probability Density.
%   See "Cyclicity in Catastrophe and Operational Risk Measurements", 
%   L. Allen and T. Bali, CUNY 2006.
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  8/24/06
%

function [pdf] = generr_pdf(x, nu, mu, sigma)

%persistent P gamodnu logP lognu t1

%if (isempty(P))
    P = sqrt(2^(-2/nu)*gamma(1/nu)/gamma(3/nu));
    logP = log(P);
    gamodnu = gammaln(1/nu);
    lognu = log(nu);
    t1 = log(2^((nu+1)/nu));
%end

pdf = exp(lognu + (-0.5.*(abs((x-mu)./(sigma*P))).^nu) - (logP + gamodnu + t1)) / sigma; 

return

Contact us