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

stsd1_pdf(x, mu, sigma, d)
% stsd1_pdf.m -evaluates a Sort-Tail Symmetric I Probability Density.
%   See "VGAM".
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  12/06/07
%

function [pdf] = stsd1_pdf(x, mu, sigma, d)

%persistent coef h sigmasq

%if(isempty(coef))
    h = 2 - d;
    sigmasq = sigma^2;
    K = 4*h^2 / (4*h^2 + 4*h + 3);
    coef = K / sqrt(2*pi*sigmasq);
%end

for jx = 1:size(x,2)
    arg = 0.5 * (x(jx) - mu)^2 / sigmasq;
    pdf(jx) = coef * exp(-arg) * (1+0.5*((x(jx)-mu)/sigma)^2/h)^2;
end

return

Contact us