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

poisf_pdf(n, k1, k2)
% poisf_pdf.m - evaluates a Poisson F Probability Density.
%   See "A Unified Approach to Some Mixed Poisson Distributions", 
%   M.E. Ghitany and S.A. Al-Awadhi, Tamsui Oxford J. of Math. Sciences, p.147, 2001.
%
%  Created by Jim Huntley,  04/16/09
%

function [pdf] = poisf_pdf(n, k1, k2)

%persistent k1d2 k2d2 lbk1d2k2d2 krat lkrat

%if(isempty(k1d2))
    k1d2 = k1 / 2;
    k2d2 = k2 / 2;
    bk1d2k2d2 = beta(k1d2,k2d2);
    lbk1d2k2d2 = log(bk1d2k2d2);
    krat = k2 / k1;
    lkrat = log(krat);
%end

a = n + k1d2;
b = n + 1 - k2d2;
z = krat;
U = KummerU(a, b, z); 
pdf = exp(n*lkrat + gammaln(n+k1d2) + log(real(U)) - lbk1d2k2d2 - gammaln(n+1)); 

return

Contact us