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

logt_pdf(x, mu, r, sigma)
% logt_pdf.m - evaluates a Log T Probability Density.
%   See "http://www.soa.org/files/pdf/Exam%20C4.pdf"
%
%  Created by Jim Huntley,  7/6/07
%

function [pdf] = logt_pdf(x, mu, r, sigma)

%persistent rd2 rp1d2 ratio

%if(isempty(rd2))
    rp1d2 = 0.5*(r+1);
    rd2 = 0.5*r;
    ratio = exp(gammaln(rp1d2)-gammaln(rd2));
%end

arg = ((log(x)-mu)/sigma)^2;
pdf = ratio / (x*sigma*sqrt(pi*r)*(1+arg/r)^rp1d2);


return

Contact us