Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

James Huntley (view profile)

 

generates random variates from over 870 univariate distributions

polyaurn_pdf(n, nn, w, b, c)
% polyaurn_pdf.m - evaluates a Polya Urn Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, 2005, p.258.    
%
%  Created by Jim Huntley,  9/18/07
%

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

%persistent coef wdc bdc

%if(isempty(coef))
    wdc = w / c;
    bdc = b / c;
    coef = 1 / beta(wdc,bdc);
%end

pdf = coef * binomial_coef(nn,n) * beta(n+wdc,nn-n+bdc);

return

Contact us