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

ncbet1_cdf(x, a, b, lambda)
% ncbet1_cdf.m - evaluates a Type 1 Non-Central Beta Cumulative Distribution.
%   See "A Note on the Noncentral Beta Distribution Function", R. Chattamvelli,
%   The American Statiticain, v.49, No.2, p.231, May 2005.
%
%   Vector form of CDF.
%
%  Created by Jim Huntley,  10/18/11
%

function [cdf] = ncbet1_cdf(x, a, b, lambda)

%persistent coef imax lambd2

%if(isempty(coef))
    lambd2 = lambda / 2;
    coef = exp(-lambd2);
    imax  = max(10,10 + 4*(lambda-2.5));
%end

for jx = 1:size(x,2)
    sumi = 0;
    for ji = 1:imax+1 
        ii = ji - 1;        
        Pi = coef * exp(ii*log(lambd2) - gammaln(ii+1));
        sumi = sumi + Pi .* betainc(x(jx),a+ii,b);
    end
    cdf(jx) = sumi;
end

return

Contact us