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

besbirnsan_pdf(x, alpha, bet, r, q)
% besbirnsan_pdf.m - evaluates a Bessel Birnbaum Sanders Probability Density.
%   See "A New Family of Life Distributions Based on Birnbaum-Sanders
%   Distribution", J.A. Diaz-Garcia and V. Leiva-Sanchez,
%   http://www.cimat.mx/reportes/enlinea/I-02-17.pdf.
%
%   Vector Form of PDF!!!
%
%   Created by Jim Huntley,  12/08/09
%

function [pdf] = besbirnsan_pdf(x, alpha, bet, r, q)

%persistent coef

%if(isempty(coef))
    coef = exp(-(q+1)*(log(2)+2*log(alpha)) - 0.5*log(pi*bet) - (q+1)*log(r) - gammaln((q+0.5)));
%end

argx = (x./bet + bet./x - 2);
argx2 = sqrt(argx) ./ (r*alpha^2);
pdf = coef .* argx.^(q/2) .* (x+bet) .* besselk(q,argx2) ./ x.^(1.5);

return

Contact us