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_pdf(x, lambda, gam, delta)
% expinvgaus_pdf.m - evaluates an Exponential Inverse Gaussian Probability Density.
%   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 the PDF!!!.
%

function [pdf] = expinvgaus_pdf(x, lambda, gam, delta)

%persistent coef

%if(isempty(coef))
    coef = 1 / (besselk(lambda,delta*gam) * delta^lambda);
%end

arg = delta^2 + 2.*x;
pdf = coef .* besselk(lambda-1, gam.*sqrt(arg)) .* gam .* arg.^(0.5*(lambda-1));

return

Contact us