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

ncnegbin_pdf(n, a, lambda, ups)
% ncnegbin_pdf.m - evaluates a Non-Central negative binomial Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, p.242, 2005. 
%
%  Created by Jim Huntley,  07/31/07
%

function [pdf] = ncnegbin_pdf(n, a, lambda, ups)

%persistent coef arg

%if(isempty(coef))
    coef = exp(-lambda) * (1-a)^ups;
    arg = lambda*(1-a);
%end    

pdf = coef * a^n * binomial_coef(ups+n-1,n) * genHyper(ups+n,ups,arg);

return


Contact us