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

wallen_pdf(n,nn,m,N,omega)
% wallen_pdf.m - evaluates a Wallenius Probability Density.
%   See "Calculation Methods for Wallenius' Noncentral Hypergeometric
%   Distribution", A. Fog, 10/26/2004.
%
%  Created by Jim Huntley,  8/03/06
%

function [pdf] = wallen_pdf(n,nn,m,N,omega)

n2 = nn-n;
m2 = N-m;
d = omega*(m-n) + m2 - n2;
bc1 = binomial_coef(m,n);
bc2 = binomial_coef(m2,n2);
sum1 = 0;
for jn = 1:n+1
    sum1 = sum1 + (-1)^(jn-1) * binomial_coef(n,jn-1) * beta(n2+1,d+omega*(jn-1));
end
pdf = bc1 * bc2 * d * sum1;

return

Contact us