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

lagbinom_pdf(n, theta, nn, m)
% lagbinom_pdf.m - evaluates a Lagrangian Binomial Probability Density.
%   See "Some Characterizations for the Exponential Class of Distributions", 
%   P. C. Consul, IEEE trans. on Reliability, vol. 44, No. 3, Sept., 1995.
%
%  Created by Jim Huntley,  8/02/06
%

function [pdf] = lagbinom_pdf(n, theta, nn, m)

%persistent lognn ltheta logomt

%if(isempty(lognn))
    lognn = log(nn);
    ltheta = log(theta);
    logomt = log(1-theta);
%end

%pdf = nn * binomial_coef(nn+m*n,n) * theta^n * (1-theta)^(n*(m-1)+nn) / (nn+m*n);
pdf = exp(lognn + log(binomial_coef(nn+m*n,n)) + n*ltheta + ...
      (n*(m-1)+nn)*logomt - log(nn+m*n));

return

Contact us