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

heine_pdf(n, eta, q)
% heine_pdf.m - evaluates a Heine Probability denisity.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   Wiley, p.534, 2005.
%
%   Created by  J. Huntley,  03/13/07.
%

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

%persistent pdf0

% Initiailizations.
%if(isempty(pdf0))
    prod = 1;
    jmax = 15/(1-q);
    for jj = 1:jmax
        prod = prod / (1-eta*q^(jj-1));
    end
    pdf0 = prod;
%end

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

return


    

Contact us