Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

James Huntley (view profile)

 

generates random variates from over 870 univariate distributions

zipf4_pdf(n, sigma, gam, alpha)
% zipf_pdf.m - evaluates a Zipf IV Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, p.532, 2005. 
%
%  Created by Jim Huntley,  11/14/06
%

function [pdf] = zipf4_pdf(n, sigma, gam, alpha)

%syms k sigma gam alpha f0 f1 f

%f0 = (1 + (k/sigma)^(1/gam))^(-alpha);              % Zipf IV Survival Function. 
%f1 = (1 + ((k+1)/sigma)^(1/gam))^(-alpha);

%f = simplify(f0 - f1);                              % Unnormalized Zipf IV pmf.

%pdf = eval(f);
pdf = ((1 + (n/sigma)^(1/gam))^(-alpha) - (1 + ((n+1)/sigma)^(1/gam))^(-alpha)); 

return


Contact us