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

binbinmix_pdf(n, N1, p1, N2, p2)
% binbinmix_pdf.m - evaluates a Beta Pascal Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, p.374, 2005. 
%
%  Created by Jim Huntley,  11/17/06
%

function [pdf] = binbinmix_pdf(n, N1, p1, N2, p2)

sum1 = 0;
jmin = fix(n/N1) + 1;

for jn = jmin:N2+1
    sum1 = sum1 + binomial_coef(N2,jn-1) * p2^(jn-1) * (1-p2)^(N2-jn+1) * ...
                binomial_coef(N1*(jn-1),n) * p1^n * (1-p1)^(N1*(jn-1)-n);
end

pdf = sum1;

return


Contact us