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

...
% mitlef_rnd.m - generates 'nsamples' of a Mittag Leffler random variable.
%   from "Discrete Self-Decomposable Distributions", K. Schreiber,
%   dissertation, Otto von Guericke U. Magdeburg, 30 Aug, 1999 +
%   "Mittag Leffler Distributions", K. Jayakumar & R.P. Suresh, U. Calicut,
%   dspace.iimk.ac.in/bitstream/123456789/152/1/Mittag.pdf.
%
%   NOTE: Explicit form for CDF is 1st reference is not generally
%   realizable due to very slow convergence and acummulated round-off error. 
%
%   Created by: J. Huntley,  01/20/09
%

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

% Initializations.
a = p_value(1);
userin.distrib = 'exp'; 
userin.ftype = 4;
userin.p_value = a;

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

% Sample Mittag Leffler Distribution.
rho = a;
pirho = pi * rho;
rand('state',1);
U = rand(1,nsamples);
W = sin(pirho) .* cot(pirho.*U) - cot(pirho);
xhold = Z .* W.^(1/a);
      
return

Contact us