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

invbin_pdf(n, rho, lambda)
% invbin_pdf.m - evaluates an Inverse Binomial Probability Density.
%   See VGAM. 
%
%  Created by Jim Huntley,  3/19/05
%

function [pdf] = invbin_pdf(n, rho, lambda)

%persistent loglam logrholam logterm

%if(isempty(loglam))
    loglam = log(lambda);
    logrholam = log(rho^lambda);
    logterm = log(rho*(1-rho));
%end

%pdf = lambda*gamma(2*n+lambda)*rho^(lambda)*(rho*(1-rho))^n / (gamma(n+1)*gamma(n+lambda+1));
pdf = exp(loglam + gammaln(2*n+lambda) + logrholam + n*logterm - ...
    (gammaln(n+1) + gammaln(n+lambda+1)));

return

Contact us