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

logseries_cdf(x,a);
% logseries_cdf.m - compute the Log Series Cumulative Distribution Function.
%               See FORTRAN code: prob_f90, John Burkhardt, 12/19/99.
%
%  Created by:  Jim Huntley,  03/12/04.
%

function [cdf] = logseries_cdf(x,a);

%               See Eric W. Weisstein. "Log-Series Distribution." 
%               From MathWorld--A Wolfram Web Resource. 
%               http://mathworld.wolfram.com/LogSeriesDistribution.html 
%               Appears to be incorrect since betainc(X,Y,0) = 0.
%
%cdf = 1 + betainc(theta,x+1,0)/log(1-theta);

cdf = 0;

  for x2 = 1:x

    if (x2 == 1)
      pdf = -a / log(1 - a);
    else
      pdf = (x2 - 1) * a * pdf / x2;
    end

    cdf = cdf + pdf;

  end

return



Contact us