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

compnorm_cdf(x,phi,sigma,theta,p)
% compnorm_cdf.m - compute Compound Normal Cumulative Distribution Function.
%   See "Continuous Univariate Distributions", Vol.2, Johnson, Kotz, and Balakrishnan,   
%   J. Wiley, 1995, p.1. 
%
%  Created by Jim Huntley,  10/07/08
%
%   Note:  Vector form of the CDF!!!
%

function [cdf] = compnorm_cdf(x,phi,sigma,theta,p)

% Integrate PDF to get CDF.
pdf = compnorm_pdf(x,phi,sigma,theta,p);
for jx = 1:size(x,2)
    if(jx == 1)
        cdf(1) = pdf(1);
    elseif(jx == 2)
        cdf(jx) = trapz(x(1:jx),pdf(1:jx));
    elseif(jx > 2)
        cdf(jx) = simps(x(1:jx),pdf(1:jx));
    end
end

return



Contact us