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

kotzbirnsan_pdf(x, alpha, bet, q, r, s)
% kotzbirnsan_pdf.m - evaluates a Kotzl 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/10/09
%

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

%persistent coef

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

argx = x./bet + bet./x - 2;
pdf = coef .* argx.^(q-1) .* exp(-r.*(argx.^s)./alpha^(2*s)) .* (x+bet) ./ x.^1.5;

return

Contact us