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

kennedy_cdf(x)
% kennedy_cdf.m - evaluates a Kennedy Cumulative Distribution.
%   See "Antipersistence in German Stock Returns", K-K Kunze & H.G. Strohe,
%   Stat. Dist No.39, Potsdam U., 2010, 
%   http://opus.kobv.de/ubp/volltexte/2010/4558/pdf/statdisk39.pdf
%
%  Created by Jim Huntley,  08/17/11
%

function [cdf] = kennedy_cdf(x)

cmin = 1e-6;
sx = size(x,2);

for jx = 1:sx
    sumk2 = 0;
    kmax = max(min(1e5,10/(x(jx))^4),100);      %heuristic
    for jk = 1:kmax
        sumk2 = sumk2 + (1-4*(jk*x(jx))^2) * exp(-2*(jk*x(jx))^2);
    end
    cdf(jx) = max(cmin,1 + 2*sumk2);
end

return

Contact us