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

logt_cdf(x,mu,r,sigma)
% logt_cdf.m - compute Log T Cumulative Distribution Function.
%   See "http://www.soa.org/files/pdf/Exam%20C4.pdf"
%
%  Created by:  Jim Huntley,  07/06/07.
%

function [cdf] = logt_cdf(x,mu,r,sigma)

%persistent rd2 expmu

%if(isempty(rd2))
    rd2 = 0.5*r;
    expmu = exp(mu);
%end

if(x <= 0)
    x = eps;
end
arg = ((log(x)-mu)/sigma)^2;
arg1 = r/(r+arg);

cdf = 0.5 * betainc(arg1,rd2,0.5);
if(x > expmu)
    cdf = 1 - cdf;
end

return



Contact us