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

invgaus3p_pdf(x, mu, lambda, tsi)
% invgaus3p_pdf.m - evaluatess a 3-Parameter Inverse Gaussian Probability Density.
%   See "Continuous Univaiate Distributions", Vol.1, Johnson, Kotz, & Balakrishnan,
%   J. Wiley, 1995, p.275.
%
%           Vector form of PDF!!!
%
%  Created by Jim Huntley,  11/04/08
%

function [pdf] = invgaus3p_pdf(x, mu, lambda, tsi)

%persistent coef mu2

%if(isempty(coef))
    coef = sqrt(0.5*lambda/pi);
    mu2 = mu * mu;
%end

argx = x - tsi;
pdf = coef .* argx.^(-1.5) .* exp(-0.5*lambda*(argx-mu).^2 ./ (argx.*mu2));

end

Contact us