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

binhypmix_pdf(n, m, N1, Np, N2)
% binhypmix_pdf.m - evaluates a Binomial Hypergeometric Mixture Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, p.375, 2005. 
%
%  Created by Jim Huntley,  11/21/06
%

function [pdf] = binhypmix_pdf(n, m, N1, Np, N2)

% Initializations.
sum1 = 0;
jmin = max(0,N1-N2+Np)+1;
jmax = min(N1,Np)+1;
coef = 1 / binomial_coef(N2,N1);

for jn = jmin:jmax
    sum1 = sum1 + binomial_coef(Np,jn-1) * binomial_coef(N2-Np,N1-jn+1) * ...
                ((jn-1)/N1)^n * (1-(jn-1)/N1)^(m-n);
end
pdf = coef * sum1 * binomial_coef(m,n);

return


Contact us