Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates


James Huntley (view profile)


generates random variates from over 870 univariate distributions

% mixinvgaus_cdf.m - compute Mixed Inverse Gaussian Cumulative Distribution Function.
%   See "Continuous Univariate Distributions", v.1, Johnson, Kotz, & Balakrishnan,
%   J. Wiley, 1995, p.286.
%   Vector form of CDF!!!
%  Created by Jim Huntley,  7/12/07

function [cdf] = mixinvgaus_cdf(x,mu,sigma,p)

tol = 1e-8;
trace = [];
warning off MATLAB:quad:MinStepSize;

minx = min(x);

% Integrate PDF to get CDF.
warning off MATLAB:quad:MinStepSize
sz = size(x,2);
for jz = 1:sz
    cdf(jz) = quad(@mixinvgaus_pdf,minx,x(jz),tol,trace,mu,sigma,p);


Contact us