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

modbinom1_cdf(n,nn,m,p)
% modbinom1_cdf.m - compute a First Modified Binomial Cumulative Distribution Function.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, p.492, 2005.                 
%
%  Created by:  Jim Huntley,  01/11/07.
%

function [cdf] = modbinom1_cdf(n,nn,m,p)

q = 1 - p;
sum1 = 0;
for jn = 1:n+1
    arg1 = nn-n*m+jn-2;
    bc = 1;
    if(arg1 >= 0)
        bc = binomial_coef(arg1,jn-1);
    end
    sum1 = sum1 + bc* p^(jn-1);
end
cdf = q^(nn-n*m) * sum1;

return



Contact us