Generation of Random Variates
09 Feb 2012
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?",
% 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);
pdf = q * p^k * (1 - sumi);