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

binomlog_pdf(n, N1, p, theta)
% binomlog_pdf.m - evaluates a Binomial Logarithmic Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, p.375, 2005. 
%
%  Created by Jim Huntley,  11/21/06
%

function [pdf] = binomlog_pdf(n, N1, p, theta)

% Initializations.
sum1 = 0;
jmin = fix(n/N1)+1;
jmax = p*theta*50;              % heuristic.

for jn = jmin:jmax
    if(jn > 1)
        sum1 = sum1 + theta^(jn-1) * binomial_coef(N1*(jn-1),n) * ...
              p^n * (1-p)^(N1*(jn-1)-n) / (jn-1);
    end
end
pdf = sum1 / (-log(1-theta));

return


Contact us