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

nc_beta_cdf(x, p, q, lambda)
% nc_beta_cdf.m - evaluates a Cumulative Non-Central Beta Distribution.
%   See "Handbook on Statistical Distributions for Experimentalists", C. Walck, 5/22/01, p.109.
%
%  Created by Jim Huntley,  8/25/04
%
%

function [cdf] = nc_beta_cdf(x, p, q, lambda)

%persistent rlimit ohlam logl

%if(isempty(logl))
    rlimit = 50;
    ohlam = 0.5 * lambda;
    logl = log(ohlam);
%end

sum1 = 0;
for jr = 1:rlimit
    %sum1 = sum1 + (0.5*lambda)^(jr-1) * exp(-0.5*lambda) * betainc(x,p+jr-1,q) / factorial(jr-1);
    sum1 = sum1 + exp((jr-1)*logl - ohlam + log(betainc(x,p+jr-1,q)+eps) - gammaln(jr));
end
cdf = sum1;  

return

Contact us