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

borelt_pdf(n, r, theta)
% borelt_pdf.m - evaluates a Borel-Tanner Probability Density.
%   See "Empirical Bayes Estimators for Borel-Tanner Distribution", G.P. Yanev & C.P. Tsokos, web.
%
%  Created by Jim Huntley,  8/20/04
%

function [pdf] = borelt_pdf(n, r, theta)

%persistent logr logth

%if(isempty(logr))
    logr = log(r);
    logth = log(theta);
%end

%pdf = r * x^(x-r-1) * theta^(x-r) * exp(-theta*x) / factorial(x-r);
 pdf = exp(logr + (n-r-1)*log(n) + (n-r)*logth - theta*n - gammaln(n-r+1));

return

Contact us