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

pearson7_pdf(x, m, MM)
% pearson7_pdf.m - evaluates the Pearson 7 Probability Density.  
% See "A Skewed Truncated Pearson Type VII Distribution", S. Nadarajah and A. K. Gupta,
% J. Japan Statistical Soc., Vol. 35, No. 1, 2005.
%
% Created by:   Jim Huntley,  08/25/06.
%

function [pdf] = pearson7_pdf(x, m, MM)

%persistent gamlnmmoh lrtpi gamlnmm1

%if(isempty(lrtpi))
    lrtmpi = log(sqrt(m*pi));
    gamlnmmoh = gammaln(MM-0.5);
    gamlnmm1 = gammaln(MM-1);
%end

%pdf = gamma(MM-0.5) .* (1 + x.^2./m).^(0.5-MM) ./ (gamma(MM-1) .* sqrt(m.*pi));
pdf = exp(gamlnmmoh + log((1 + x.^2./m).^(0.5-MM)) - (gamlnmm1 + lrtmpi));

return

Contact us