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

genlapldif_pdf(x, mu, lambda, theta, phi)
% genlapldif_pdf.m - evaluates a Generalized Laplace Difference Probability Density.
%   See "The Linear Combination, Product and Ratio of Laplace Random Variables", 
%   Statistics, Vol.41, No.6, p.535, December, 2007,
%   http://pdfserve.informaworld.com/566451__787690033.pdf.
%
%  Created by Jim Huntley,  01/28/10
%

function [pdf] = genlapldif_pdf(x, mu, lambda, theta, phi)

for jx = 1:size(x,2)
    if(phi > theta-x(jx))
        pdf(jx) = (lambda.*mu.*(lambda./exp(mu.*(phi - theta + x(jx))) - mu./exp(lambda.*(phi - theta + x(jx))))) ./ ...
                   (2.*(lambda^2 - mu^2));        
    elseif(phi <= theta-x(jx))
        pdf(jx) = (lambda.*mu.*(lambda.*exp(mu.*(phi - theta + x(jx))) - mu.*exp(lambda.*(phi - theta + x(jx))))) ./ ...
                    (2.*(lambda^2 - mu^2));
    end
end

return

Contact us