Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

James Huntley (view profile)

 

generates random variates from over 870 univariate distributions

skewgent_pdf(x, mu, sigma, n, k, lambda)
% skewgent_pdf.m - evaluates a Skewed Generalized T Probability Density.
%   See "Cyclicality in Catastrophic and Operational Risk Measurements", 
%   L Allen and T.G. Bali, CUNY.
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  8/24/06
%

function [pdf] = skewgent_pdf(x, mu, sigma, n, k, lambda)

A = beta(2/k,(n-1)/k)/sqrt(beta(1/k,n/k))/sqrt(beta(3/k,(n-2)/k));
S = sqrt(1+3*lambda^2-4*A^2*lambda^2);
theta = (k/(n-2))^(1/k)*sqrt(beta(1/k,n/k))/sqrt(beta(3/k,(n-2)/k))/S;
C = k / ((2*(n-2)/k)^(1/k)*theta*beta(1/k,n/k));
delta = 2*lambda*A/S;

sx = size(x,2);

for jx = 1:sx
    epsi = x(jx) - mu + delta*sigma;
    pdf(jx) = C * (1 + (abs(epsi))^k/((n-2)/k)/(1+sign(epsi)*lambda)^k/theta^k/sigma^k)^((-n+1)/k) / sigma;    
end 

return

Contact us