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_pdf(x, alpha, bet, nu, tau)
% dbparlogn_pdf.m - evaluates a Double Pareto Lognormal Probability Density.
%   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 [pdf] = dbparlogn_pdf(x, alpha, bet, nu, tau)

%persistent coef npat2 nmbt2

%if(isempty(coef))
    coef = alpha*bet / (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;
    pdf(jx) = coef * (A(alpha,nu,tau) * x(jx)^(-alpha-1) * gaus_cdf(arg1,0,1) + ...
              x(jx)^(bet-1) * A(-bet,nu,tau) * (1 - gaus_cdf(arg2,0,1)));
end

return

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

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

return

Contact us