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

dbparlogn_cdf(x, alpha, bet, nu, tau)
% dbparlogn_cpdf.m - evaluates a Double Pareto Lognormal Cuimulative Distribution.
%   See "The Double Pareto-Lognormal Distribution - 
%   A New Parametric Model for Size Distributions", W.J Reed & M. Jorgensen,
%   http://citeseer.ist.psu.edu/691544.html
%
%   Created by: J. Huntley, 02/20/08
%

function [cdf] = dbparlogn_cdf(x, alpha, bet, nu, tau)

%persistent apb npat2 nmbt2

%if(isempty(apb))
    apb = alpha + bet;
    npat2 = nu + alpha*tau^2;
    nmbt2 = nu - bet*tau^2;
%end

for jx = 1:size(x,2)
    arg1 = (log(x(jx))-npat2)/tau;
    arg2 = (log(x(jx))-nmbt2)/tau;
    arg3 = (log(x(jx))-nu)/tau;
    cdf(jx) = gaus_cdf(arg3,0,1) - (bet * A(alpha,nu,tau) * x(jx)^(-alpha) * gaus_cdf(arg1,0,1) - ...
              alpha * x(jx)^(bet) * A(-bet,nu,tau) * (1 - gaus_cdf(arg2,0,1))) / apb;
end

return

function [a] = A(theta, nu, tau)

a = exp(theta*nu + 0.5*theta^2*tau^2);

return

Contact us