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

kempqbin_pdf(n, N, c, q)
% kempqbin_pdf.m - evaluates a Kemp Q-Binomial Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp & Kotz,
%   J. Wiley, 2005, 468. 
%
%  Created by Jim Huntley,  6/22/07
%

function [pdf] = kempqbin_pdf(n, N, c, q)

prod1 = 1;
for ji = 1:N
    prod1 = prod1 * (1 + c*q^(ji-1));
end
pdf = 1 / prod1;        
if(n > 0)
    prodn = 1;
    prodd = 1;
    for ji = 1:n
        prodn = prodn * (1-q^(N-ji+1));
        prodd = prodd * (1-q^ji);
    end
    pdf = prodn * q^(n*(n-1)/2) * c^n * pdf / prodd;        
end
    
return

Contact us