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

genurn_pdf(n, nn, w, b, c)
% genurn_pdf.m - evaluates a General URN Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, p.251, 2005. 
%
%  Created by Jim Huntley,  02/16/07
%

function [pdf] = genurn_pdf(n, nn, w, b, c)

arg1 = -(w + b) / c;
arg2 = -w / c;
nn = fix(-w/c)+1;

pdf = binomial_coef(nn,n) * binomial_coef(-nn+arg1,-n+arg2) / ...
      binomial_coef(arg1,arg2);

return


Contact us