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

chernoff_cdf(x)
% chernoff_cdf.m - compute a Chernoff Cumulative Distribution Function.
%   See "Computing Chernoff's Distribution", 
%   P. Groeneboom and J. A. Wellner, 3 November, 1999.               
%
%               Vector Form of CDF !!!
%
%  Created by:  Jim Huntley,  09/13/06.
%

function [cdf] = chernoff_cdf(x)

% Integrate PDF to get CDF.
pdf = chernoff_pdf(x);
sz = size(x,2);
for jz = 1:sz
    if(jz == 1)
        cdf(jz) = trapz(pdf(1:jz)) * (x(end)-x(1)) / sz;
    else
        cdf(jz) = simps(pdf(1:jz)) * (x(end)-x(1)) / sz;
    end
end

return



Contact us