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

geninvneghyp_pdf(n, r, a, b, c, t)
% geninvneghyp_pdf.m - evaluates an Generalized Inverse Negative 
%   Hypergeometric Probability Density.
%   See "On a Generalized Markov-Polya Distribution",
%   K. G. Janardan,Gujarat Statistical Review, Vol.V, No.1, April, 1978.
%
%  Created by Jim Huntley,  7/30/07
%
%   NOTE:  distribution does not normalize correctly - 
%          possibly due to round-ff problems in the long, heavy tail!!!
%
%   Calls:  Jk(k,a,c,t)
%

function [pdf] = geninvneghyp_pdf(n, r, a, b, c, t)

J1 = Jk(r,a,c,t);
J2 = Jk(n,b,c,t);
J3 = Jk(r+n,a+b,c,t);
pdf = exp(log(binomial_coef(r+n-1,n)) + J1 + J2 - J3);    

return

function [val] = Jk(k, a, c, t)

if(k == 0)
    val = 0;
elseif(k > 0)
    val = log(a);
    for jk = 1:k-1
        val = val + log(a+k*t+jk*c);
    end
end

return

Contact us