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

kappa4p_pdf(x, h, k, tsi, alpha)
% kappa4p_pdf.m - evaluates a Kappa 4-Parameter Probability Density.
%   See "The Four-Parameter Kappa Distribution", J. R. M. Hosking,
%   IBM Jour. Res. Develop., vol.68, No.3, May 1994.
%
%  Created by Jim Huntley,  12/21/07
%

function [pdf] = kappa4p_pdf(x, h, k, tsi, alpha)

cdf = kappa4p_cdf(x, h, k, tsi, alpha);
if(k ~= 0 && h ~= 0)
    pdf = cdf^(1-h) * (1 - k*(x-tsi)/alpha)^(1/k - 1) / alpha;
elseif(k ~= 0 && h == 0)
    pdf = cdf^(1-h) * (1 - k*(x-tsi)/alpha)^(1/k - 1) / alpha;
elseif(k == 0 && h ~= 0)
    pdf = cdf^(1-h) * exp(-(x-tsi)/alpha) / alpha;
elseif(k == 0 && h == 0)
    pdf = cdf^(1-h) * exp(-(x-tsi)/alpha) / alpha;
end;

return

Contact us