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

lapnormmix_pdf(x, tsi, sigma, alpha, bet)
% lapnormmix_pdf.m - evaluates a Laplace Normal Mixture Probability Density.
%   See "Continuous Univariate Distributions", v.1, Johnson, Kotz, & Balakrishnan,
%   J. Wiley, 1995, p.171.
%
%  Created by Jim Huntley,  12/11/08
%

function [pdf] = lapnormmix_pdf(x, tsi, sigma, alpha, bet)

%persistent sigma2 c1 c2

%if(isempty(c1))
    sigma2 = sigma^2;
    c1 = 0.5 * alpha / bet;
    c2 = (1-alpha) / (sqrt(2*pi*sigma2));
%end

pdf = c1 * exp(-abs(x-tsi)/bet) + c2 * exp(-0.5*(x-tsi)^2/sigma2);

return

Contact us