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

ztbin_pdf(n, nn, p)
% ztbin_pdf.m - evaluates a Zero-Truncated Binomial Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp & Kotz,
%   J. Wiley, 2005, p.137.
%
%  Created by Jim Huntley,  10/03/07
%

function [pdf] = ztbin_pdf(n, nn, p)

%persistent coef q

%if(isempty(coef))
    q = 1 - p;
    coef = 1 / (1 - q^nn);    
%end

pdf = coef * binomial(nn,n) * p^n * q^(nn-n);
    
return

Contact us