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

famhist_pdf(n, nn, p, pp)
% famhist_pdf.m - evaluates a Family History (Yu & Zelterman) Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, p.155, 2005. 
%
%  Created by Jim Huntley,  01/11/07
%

function [pdf] = famhist_pdf(n, nn, p, pp)

pdf = (1 - p )^nn;
if(n > 0)
    sum1 = 0;
    for jn = 1:nn-n+1
        sum1 = sum1 + binomial_coef(nn-jn,n-1) * (1-p)^(jn-1) * (1-pp)^(nn-n-jn+1);
    end
    pdf = p * pp^(n-1) * sum1;
end

return


Contact us