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

pig_pdf(n, alpha, theta)
% pig_pdf.m - evaluates a Poisson Inverse Gaussian (PIG) Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, & Kotz, 
%   J. Wiley, 2005, 485. 
%
%  Created by Jim Huntley,  8/30/07
%

function [pdf] = pig_pdf(n, alpha, theta)

%persistent coef logat

%if(isempty(coef))
    coef = log(sqrt(2*alpha/pi) * exp(alpha*sqrt(1-theta)));
    logat = log(0.5*alpha*theta); 
%end

pdf = exp(coef + n*logat + log(besselk(n-0.5,alpha)) - gammaln(n+1));
    
return

Contact us