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

zip_pdf(n, omega, lambda)
% zip_pdf.m - evaluates a Zero-Inflated Poisson Probability Density.
%   See "Models for Count Data with Many Zeros", 
%   International Biometric Conference Cape Town, December 1998, Martin Ridout.
%
%  Created by Jim Huntley,  5/19/05
%

function [pdf] = zip_pdf(n, omega, lambda)

if(n == 0)
    pdf = omega + (1-omega)*exp(-lambda);
end
if(n > 0)
    %pdf = (1-omega) * exp(-lambda) * lambda^n / factorial(n);
    pdf = (1-omega) * exp(-lambda + n*log(lambda) - gammaln(n+1));
    
end

return

Contact us