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

parratio_pdf(x, a1, a2, k1, k2)
% parratio_pdf.m - evaluates a Pareto Ratio Probability Density.
%   See "Continunous Univariate Distributions", v.1, Johnson, Kotz, & Balakrishnan,
%   J. Wiley, 1995, p.606.
%
%   Creadted by:    J. Huntley,     08/08/07
%

function [pdf] = parratio_pdf(x, a1, a2, k1, k2)

%persistent coef krat oda1p2

%if(isempty(coef))
    krat = k1 / k2;
    oda1p2 = 1 /(a1+a2);
    coef = a1 * a2 * oda1p2 / krat;
%end

if(x <= krat)
    pdf = coef * (x/krat)^(a2-1);
elseif(x > krat)
    pdf = coef * (x/krat)^(-a1-1);
end

return

Contact us