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

extnegbin_pdf(n, m, theta, bet)
% extnegbin_pdf.m - evaluates an Extended Negative Binomial Probability Density.
%   See "An Extension of Panjer's Recursion", K. Hess et al., Dresden,
%   casualtyactuaries.com/library/astin/vol32no2/283.pdf.
%
%  Created by Jim Huntley,  11/14/06
%

function[pdf] = extnegbin_pdf(n, m, theta, bet)

%persistent coef

%if(isempty(coef))
    sumj = 0;
    for jj = 1:m
        j = jj - 1;
        sumj = sumj + theta^j * binomial_coef(bet+j-1,j);
    end
    coef = 1 / ((1-theta)^(-bet) - sumj);
%end

pdf = coef * theta^n * binomial_coef(bet+n-1,n);

return



Contact us