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

okcorral_pdf(n, nn, m)
% eggpol2_pdf.m - evaluates a Polya Eggenberger Probability Density.
%   "Analysis of Some Exactly Solvable Diminishing Urn Problems",
%   H-K. Hwang et al, Formal Power Series and Algeraic Combinatorics, Tainjin, 2007.
%
%  Created by Jim Huntley,  03/05/07
%

function [pdf] = okcorral_pdf(n, nn, m)

mnfac = gammaln(nn+m+1);

sum = 0;
for jr = 1:nn
    sum = sum + (-1)^(nn-jr) * binomial_coef(nn+m,nn-jr) * ...
          binomial_coef(jr-1,n-1) * jr^(nn+m-n);
end

pdf = exp(gammaln(n+1) + log(sum) - mnfac);


return


Contact us