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

nggsd_pdf(n, alpha, bet, jj, nmin, nmax)
% nggsd_pdf.m - evaluates a New Generalized Geometric Series Distribution Probability Density.
%   See "New Generalizations of Generalized Geometric Series Distributions",   
%   A. Hassan, African J. of Math and Comp Sci Research, vol.3, no.5, May, 2010. 
%
%  Created by Jim Huntley,  08/29/11
%

function [pdf] = nggsd_pdf(n, alpha, bet, jj, nmin, nmax)

%persistent lalph loma logMj

%if(isempty(loma))
    lalph = log(alpha);
    loma = log(1 - alpha);
    summ = 0;
    for jn = nmin+1:nmax+1
        nj = jn - 1;
        summ = summ + exp(gammaln(1+bet*nj) + nj*lalph + (1+bet*nj-nj+jj)*loma - ...
                          gammaln(nj+1) - gammaln(bet*nj-nj+jj+2));
    end
    logMj = log(summ);
%end

pdf = exp(gammaln(bet*n+1) + n*lalph + (1+bet*n-n+jj)*loma - ...
                  gammaln(n+1) - gammaln(bet*n-n+jj+2) - logMj);

return

Contact us