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

sichel_pdf(n, nu, theta, bet)
% sichel_pdf.m - evaluates a Sichel (GIGP) Probability Density.
%   See "Assessing Microdata Disclose Risk Using the Poisson-Inverse Gaussian Distribution",
%   M. Carlson, Statistics in Transition, Vol. 5, No. 6, p. 901, Dec., 2002
%
%  Created by Jim Huntley,  8/17/04
%

function [pdf] = sichel_pdf(n, nu, theta, bet)

%persistent logt1 logt2 t3

%if(isempty(logt1))
    logt1 = log(1-theta);
    logt2 = log(0.5*bet*theta);
    t3 = bet*sqrt(1-theta);
%end

%pdf = (1-theta)^(0.5*nu) * (0.5*bet*theta)^n * besselk(n+nu,bet) / ...
%   (factorial(n)*besselk(nu,bet*sqrt(1-theta)));
pdf = exp((0.5*nu)*logt1 + n*logt2 + log(besselk(n+nu,bet)) - ...
    (gammaln(n+1) + log(besselk(nu,t3))));

return

Contact us