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

gennegbin_pdf(n, alphat, bet, m)
% gennegbin_pdf.m - evaluates a Generalized Negative Binomial Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp & Kotz,
%   J. Wiley, p.256, 2005. 
%
%  Created by Jim Huntley,  02/12/07
%

function [pdf] = gennegbin_pdf(n, alphat, bet, m)

%pdf = m * gamma(m+bet*n) * alphat^n * (1-alphat)^(m+bet*n-n) / ...
%      (factorial(n) * gamma(m+bet*n-n+1));
pdf = exp(log(m) + gammaln(m+bet*n) + n*log(alphat) + (m+bet*n-n)*log(1-alphat) - ...
      (log(factorial(n)) + gammaln(m+bet*n-n+1)));

return


Contact us