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

wgenpois_pdf(n, a, z)
% wgenpois_pdf.m - evaluates a Weighted Generalized Poisson Probability Density.
%   See "Parameter Estimation, Data Fitting, and Limiting Distribution of QBD III and QBD IV",
%   S. Chakraborty, Dibrugargh U., SCRA 2004 FIM XI, Dec.27-29, 2004, Inst. of Engr. & Tech.,
%   Lucknow, India.
%
%  Created by Jim Huntley,  01/22/08
%

function [pdf] = wgenpois_pdf(n, a, z)

%persistent coef

%if(isempty(coef))
    coef = a^2 * (a+z) / (a*(1-z)+z);
    coef = log(coef);
%end

%pdf =  coef * (a+n*z)^(n-2) * exp(-(a+n*z)) / gamma(n+1);
pdf =  exp(coef + (n-2)*log(a+n*z) - (a+n*z) - gammaln(n+1));

return


Contact us