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

comintpois_pdf(n, theta, lambda, rho)
% comintpois_pdf.m - evaluates a Compound Intervened Poisson Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, p.207, 2005. 
%
%  Created by Jim Huntley,  12/05/06
%

function [pdf] = comintpois_pdf(n, theta, lambda, rho)

%persistent t1 t2 t3

%if(isempty(t1))
    t1 = (theta*(1-lambda-lambda*rho));
    t2 = log(exp(theta) - 1);
    t3 = log(lambda*theta);
%end

%pdf = exp(theta*(1-lambda-lambda*rho)) * ((1+rho)^n - rho^n*exp(-theta*(1-lambda))) ...
    %      * (lambda*theta)^n / (factorial(n)*(exp(theta) - 1));
pdf = exp(t1 + log((1+rho)^n - rho^n*exp(-theta*(1-lambda))) ...
              + n*t3 - (gammaln(n+1) + t2));

return


Contact us