Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates


James Huntley (view profile)


generates random variates from over 870 univariate distributions

logt_pdf(x, mu, r, sigma)
% logt_pdf.m - evaluates a Log T Probability Density.
%   See ""
%  Created by Jim Huntley,  7/6/07

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

%persistent rd2 rp1d2 ratio

    rp1d2 = 0.5*(r+1);
    rd2 = 0.5*r;
    ratio = exp(gammaln(rp1d2)-gammaln(rd2));

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


Contact us