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

simplex_pdf(x, sigma, mu)
% simplex_pdf.m - evaluates a simplex Probability Density.
%   See "VGAM Family Functions for Univariate Distributions", Beta Version 0.5-15,
%   T. W. Yee, Univserity of Aukland, 1/06/2004.
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  07/17/06
%
%

function [pdf] = simplex_pdf(x, sigma, mu)

sx = size(x,2);
denom = sqrt(2*pi*sigma^2);
denomexp = 2*sigma^2*mu^2*(1-mu)^2;

for jx = 1:sx
    arg = x(jx)*(1 - x(jx));
    if(abs(denomexp) < eps)
        pdf(jx) = 0;
    else
        pdf(jx) = exp(-(x(jx)-mu)^2 / (denomexp * arg)) / (arg^1.5 * denom);
    end
end

return

Contact us