Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates


James Huntley (view profile)


generates random variates from over 870 univariate distributions

poshyper_pdf(n, nn, N, Np)
% polyaurn_pdf.m - evaluates a Positive Hypergeometric Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, 2005, p.296.    
%  Created by Jim Huntley,  9/19/07

function [pdf] = poshyper_pdf(n, nn, N, Np)

%persistent coef 

    coef = 1 / (binomial_coef(N,nn) - binomial_coef(N-Np,nn));

pdf = coef * binomial_coef(Np,n) * binomial_coef(N-Np,nn-n);


Contact us