Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates


James Huntley


generates random variates from over 870 univariate distributions

asymsub_pdf(x, alpha, kappa, sigma, theta)
% asymsub_pdf.m - evaluates an Asymmetric Subbotin Probability Density.
%   See "Macroeconomic Fluctuations and the Firms' Rate of Growth Distribution:
%   Evidence from US and UK Quoted Companies," E. Santoro, Cambridge, Oct., 2006.
%   Vector form of PDF!!!
%  Created by Jim Huntley,  7/6/07

function [pdf] = asymsub_pdf(x, alpha, kappa, sigma, theta)

%persistent ka sa coef 

    ka = kappa^alpha;
    sa = sigma^alpha;
    coef = exp(log(alpha*kappa) -(gammaln(1/alpha)+log(sigma)+log(1+kappa^2)));

for jx = 1:size(x,2)
    if(x(jx) < theta)
        pdf(jx) = exp(-abs(x(jx)-theta)^alpha/(sa*ka)) * coef;
    elseif(x(jx) >= theta)
        pdf(jx) = exp(-(x(jx)-theta)^alpha*ka/sa) * coef;


Contact us