Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates


James Huntley (view profile)


generates random variates from over 870 univariate distributions

subbgeom_pdf(n, q)
% subbgeom_pdf.m - evaluates a Subcritical Geometric Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, p.472, 2005. 
%  Created by Jim Huntley,  10/09/07

function [pdf] = subbgeom_pdf(n, q)

%persistent coef 

    coef = (1 - q)^2;

pdf = coef * q^(n-1) / ((1-q^n) * (1-q^(n+1)));


Contact us