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

euler_pdf(n, eta, q)
% euler_pdf.m - evaluates an Euler Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp & Kotz,
%   J. Wiley, p.470, 2005. 
%
%  Created by Jim Huntley,  01/03/07
%

function [pdf] = euler_pdf(n, eta, q)

%persistent jlim prod0

%if(isempty(jlim))
    jlim = max(200,fix(1 / ((1-eta) * (1-q)) + 1e-7));          % heuristic
    prod0 = 1;
    for jj = 1:jlim
        prod0 = prod0 * (1-eta*q^(jj-1));
    end
%end

pdf = prod0;
if(n > 0)
    prod = 1;
    for jj = 1:n
        prod = prod * (1-q^jj);
    end
    pdf = eta^n * prod0 / prod;
end

return


Contact us