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

laplmsum_pdf(x, n)
% laplmsum_pdf.m - evaluates a Laplace Multiple Sum (Unit Std Dev) Power Probability Density.
%   See "The Laplace Distribution and Generalizations", S. Kotz et al.,
%   2001, Birkhauser, p.43.
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  1/24/08
%

function [pdf] = laplmsum_pdf(x, n)

%persistent coef

%if(isempty(coef))
    coef = -gammaln(n) - n*log(2);
%end

for jx = 1:size(x,2)
    sumj = 0;
    for jj = 1:n
        j = jj - 1;
        sumj = sumj + exp(gammaln(n+j) + (n-1-j)*log(abs(x(jx))) - ...
               (gammaln(n-j)+gammaln(j+1)+j*log(2)));
    end    
    pdf(jx) = exp(coef - abs(x(jx)) + log(sumj));
end

return

Contact us