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

...
% ades_rnd.m - generates 'nsamples' of an Ades random variable.
%   from "Univariate Discrete Distributions", Johnson, Kemp, & Kotz,
%   Wiley, p.494, 2005.
%
%   Created by: J. Huntley,  12/07/06
%

function [xhold,fhold,ghold,jhold,xsort,fsort,gsort,chold,isint] = ...
          ades_rnd(userin,p_value,nsamples)

% Initializations.
a = p_value(1);
b = 1 / p_value(2);
c = p_value(3);
userin.distrib = 'gamma'; 
userin.ftype = 4;
userin.p_value = [a 0 b];

% Sample Gamma Distribution.
[xhold,fhold,ghold,jhold,xsort,fsort,gsort,chold,isint] =  gen_distrib2(userin,0);

% Sample Ades Distribution.
for jx = 1:nsamples
    xxx = 0;
    if(xhold(jx) > 1)
        xxx = log(xhold(jx))^c;
    end
    xhold(jx) = xxx;
end
      
return

Contact us