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

hoppe_pdf(n, N, a)
% hoppe_pdf.m - evaluates a Hoppe's Urn Probability Density.
%   "On the Number of Consecutive Successes in Bernoulli Trials",
%   L. Holst, Royal Inst. of Tech, Stockholm. 
%
%  Created by Jim Huntley,  02/26/07
%

function [pdf] = hoppe_pdf(n, N, a)

%persistent aN

%if(isempty(aN))
    sum = 0;
    for jj = 1:N
        sum = sum + stirling1(N,jj) * a^jj;
    end
    aN = sum;
%end

pdf = stirling1(N,n) * a^n / aN;

return


Contact us