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

interrupt_pdf(n,K,D,tau)
%interrupt_pdf.m - evaluates an Interrupted Probability Density Distribution.
%   "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   Wiley, 2005, p. 503.

function[pdf] = interrupt_pdf(n,K,D,tau)

ny = 100;
g = 0;
if(n <= tau/D)
    g = 1 - n*D/tau;
end
ymin = g;
ymax = 1 -(n-1)*D/tau;
dy = (ymax-ymin) / ny;
y = ymin:dy:ymax;
coef = binomial_coef(K,n);
kern = y.^(n-1) .* (1-y).^(K-n);
I = trapz(kern)*dy;
pdf = coef * ((n*D/tau)^(K-n) * g^n + n*I);

return
    
    
    
    



Contact us