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

dstable_pdf(n, gam, lambda)
% dstable_pdf.m - tests a Discrete Stable Probability Density.
%   See "Discrete Stable random Variables", G. Christop and K. Schreiber,
%   U. Magdeburg.
%
%  Created by Jim Huntley,  8/08/06
%

function [y] = dstable_pdf(n, gam, lambda)

if(n == 0)
    y = exp(-lambda);
elseif(n > 0)
    coef = lambda / (n+1);    
    sum = 0;
    for mm = 1:n+1
        m = mm - 1;
        pterm = y(n-m+1) * (m+1) * (-1)^m;
        prod = gam;
        for j = 1:m
           prod = prod * (gam-j);
        end
        sum = sum + pterm*prod/factorial(m+1);
        y = coef * sum;
    end       
end

return

Contact us