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

qb_pdf(n, p, s, t, phi, nn)
% qb_pdf.m - evaluates a Quasi Binomial Probability Density.
%   See "Some Aspects of a Sub-Class of Modified Power Series Distributions",
%   S. Chakraborty, Dibrugargh U., http://interstat.statjournals.net/YEAR/2006/articles/0604001.pdf 
%
%  Created by Jim Huntley,  01/14/08
%

function [pdf] = qb_pdf(n, p, s, t, phi, nn)

%persistent B

%if(isempty(B))
    sumk = 0;
    for kk = 1:nn+1
        k = kk - 1;
        sumk = sumk + binomial_coef(nn,k) * (p+k*phi)^(k+s) * (1-p-k*phi)^(nn-k+t);
    end
    B = sumk;
%end

pdf = binomial_coef(nn,n) * (p+n*phi)^(n+s) * (1-p-n*phi)^(nn-n+t) / B;

return


Contact us