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

lifetest_pdf(n, m, nn, r)
% lifetest_pdf.m - evaluates a Life Testing Probability Density.
%   See "Continuous Univariate Distributions", v.2, Johson, Kotz, &
%   Balakrishnan, J. Wiley, 1995, p.309.
%
%  Created by Jim Huntley,  12/17/08
%

function [pdf] = lifetest_pdf(n, m, nn, r)

pdf = A(m-n, nn, nn, r-1, m);

return

function [AA] = A(t, q, n, p, m)

coef = log(n) - gammaln(p+1);

sumi = 0;
for ji = 1:t
    i = ji - 1;
    sumi = sumi + (-1)^i * binomial_coef(p,i) * (t-i)^(n-1) / (m-i)^(q-p);
end
AA = exp(coef + log(sumi));

return
    

Contact us