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

fmax_cdf(x, nu, k)
% fmax_cdf.m - evaluates an F Maximum Cumulative Distribution.
%   See "Continuous Univariate Distributions", Johnson, Kotz & Balakrishnan,
%   Vol. 2, J. Wiley, 1995, p.353.
%
%  Created by Jim Huntley,  11/20/06
%

function[cdf] = fmax_cdf(x, nu, k)

%persistent nud2 coef ny ymin

%if(isempty(coef))
    nud2 = 0.5 * nu;
    coef = exp(-k*(nud2*log(2)+gammaln(nud2)));
    ny = 1000;
    ymin = eps;
%end

for jx = 1:size(x,2)
    ymax = x(jx);
    dy = (ymax-ymin) / (ny-1);
    y = ymin:dy:ymax;
    kern = y.^(nud2-1) .* exp(-0.5.*y);
    ikern = simps(y,kern);    
    cdf(jx) = coef .* ikern.^k;
end

return



Contact us