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

expinvgaus_cdf(x,lambda,gam,delta)
% expinvgaus_cdf.m - compute an Exponential Inverse Gaussian Cumulative Distribution Function.
%   See "Modelling Losses Using an Exponential Inverse Gaussian Distribution", 
%   N. Frangos & D. Karlis, Insurance: Mathematics and Economics 35, p.53, 2004.
%
%  Created by Jim Huntley,  05/05/09               
%
%               Vector Form of CDF !!!
%


function [cdf] = expinvgaus_cdf(x,lambda,gam,delta)

tol = 1e-8;
trace = [];
warning off MATLAB:quad:MinStepSize;

minx = min(x);

% Integrate PDF to get CDF.
warning off MATLAB:quad:MinStepSize
sz = size(x,2);
for jz = 1:sz
    cdf(jz) = quad(@expinvgaus_pdf,minx,x(jz),tol,trace,lambda,gam,delta);
end

return



Contact us