Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

James Huntley (view profile)

 

generates random variates from over 870 univariate distributions

trunlerch_cdf(n, a, b, z, s, ups)
% trunlerch_cdf.m - evaluatess a Truncated Lerch Cumulative Distribution.
%   See "Auxiliary Information for Article
%   Some Properties of the Lerch Family of Discrete Distributions", 
%   S.V. Askenov and M.A. Savageau, preprint submitted to Elsevier Science,
%   1 February, 2008.
%
%  Created by Jim Huntley,  12/16/08
%

function [cdf] = trunlerch_cdf(n, a, b, z, s, ups)

%persistent c c1

%if(isempty(c))
    c1 = z^a * lerch(z, s, ups+a);
    c = 1 / (c1 - z^(b+1) * lerch(z,s,ups+b+1));
%end

cdf = c * (c1 - z^(n+1) * lerch(z,s,ups+n+1)); 

return

Contact us