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

invabsorp_pdf(n,q,k,m)
% invabsorp_pdf.m - evaluatess an Inverse Ansorption Probability Density.
%   See "Probability and Stistical Models with Applications", Charalambides
%   Koutras, and Balakrishnan, Chapman & Hall/CRC, 2001, p. 240.
%
%  Created by Jim Huntley,  06/18/07
%

function [pdf] = invabsorp_pdf(n,q,k,m)

%persistent prod1

%if(isempty(prod1))
    prod1  = 1;
    for jj = m:-1:m-k+1
        prod1 = prod1 * (1 - q^jj);
    end
%end

pdf = prod1;
if(n > 0)    
    nprod = 1;
    dprod = 1;
    for jn = 1:n
        nprod = nprod * (1 - q^(k+jn-1));
        dprod = dprod * (1 - q^jn);
    end
    pdf = q^((m-k+1)*n) * prod1 * nprod / dprod;
end

return


Contact us