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

waittime_pdf(n, p, k, nn)
% waittime_pdf.m - evaluates a Waiting Time Probability Density.
%   See "How does Tandem Repeats Finder work?",
%   "http://tandem.bu.edu/trf/trfdesc.html".
%
%   NOTE: This distribution is the same as Geometric Order K !!! 
%   However, this recurrsive calculation is MUCH faster than the 
%   Diophantine solution method used in 'test_geomordk.m' !!!
%
%  Created by Jim Huntley,  01/04/08
%

function [pdf] = waittime_pdf(n, p, k, nn)

q = 1 - p;

if(n < k)
    pdf = 0;
elseif(n == k)
    pdf = p^k;
elseif(n > k)
    sumi = 0;
    for i = 1:n-k
        sumi = sumi + pdf_hold(i);
    end
    pdf = q * p^k * (1 - sumi);
end

return


Contact us