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

parnprod2_pdf(x, nn, a, k)
% test_parnprod2.m - tests a Pareto n-Product  constant "a" Probability Density.
%   See "Continuous Univariate Distributions", Vol.1, Johnson, Kotz
%   and Balakrishnan, p.605, 1995.
%
%   Vector form of PDF!!!
%
%  Created by Jim Huntley,  04/08/09
%

function [pdf] = parnprod2_pdf(x, nn, a, k)

%persistent m glnnn

%if(isempty(m))
    m = prod(k);
    glnnn = gammaln(nn);
%end

arg = x ./ m;
%pdf = (a.*log(arg)).^(nn-1) .* arg.^(-a) .* (a./x) ./ gamma(nn);
pdf = exp((nn-1).*log(a.*log(arg)) - a.*log(arg) + log(a./x) - glnnn);

return

Contact us