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

claplnorm_pdf(x, sigma, tsi, phi)
% claplnorm_pdf.m - evaluates a Compound Laplace Normal Probability Density.
%   See "Continuous Univariate Distributions", Vol.2, Johnson, Kotz &
%   Balakrishnan, p.194, 1995.
%
%   Vector form of PDF!!!
%
%  Created by Jim Huntley,  04/01/09
%
%   Calls:  'gaus_cdf.m'
%

function [pdf] = claplnorm_pdf(x, sigma, tsi, phi)

%persistent coef

%if(isempty(coef))
    coef = 0.5 * exp(0.5*sigma^2/phi^2) / phi;
%end

arg = (x - tsi)./sigma - sigma/phi;
arg1 = (tsi - x)./sigma - sigma/phi;
arg2 = (x - tsi) ./ phi;
PHI = gaus_cdf(arg,0,1);
PHI1 = gaus_cdf(arg1,0,1);
pdf = coef .* (PHI.*exp(-arg2) + PHI1.*exp(arg2));

return

Contact us