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

gamwarn_pdf(x, a, d, m, p, nn)
% gamwarn_pdf.m - evaluates a Gamma Warning Time Probability Density.
%   See "A Beta Warning Time Distribution and a Distended Beta Distribution",
%	H.W. Block & B.R. Rao, Indian J. of Stat., V.35, Series B, Pt.1,1973, p.79.  
%
%       Vector Form of PDF !!!
%
%  Created by Jim Huntley,  01/05/09
%

function[pdf] = gamwarn_pdf(x, a, d, m, p, nn)

%persistent mm1 nm1 dmmmn coef ny ymax

%if(isempty(coef))
    mm1 = m - 1;
    nm1 = nn - 1;
    dmmmn = d - m - nn;
    coef = p / (beta(m,nn)*gamma(d/p)*a^d);
    ny = 1000;
    yscale = 1;
    ymax = x(end) * yscale;
%end

for jx = 1:size(x,2)
    ymin = x(jx);
    dy = (ymax-ymin) / (ny-1);
    y = ymin:dy:ymax;
    kern = y.^dmmmn .* (y-x(jx)).^nm1 .* exp(-(y./a).^p);
    inty = simps(kern) * dy;
    pdf(jx) = coef * x(jx)^mm1 * inty;
end

return



Contact us