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

logbirnsan_pdf(x, alpha, bet)
% logbirnsan_pdf.m - evaluates a Logistic 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/07/09
%

function [pdf] = logbirnsan_pdf(x, alpha, bet)

%persistent coef

%if(isempty(coef))
    ymin = 0;
    ymax = 20;
    ny = 1000;
    dy = (ymax-ymin) / (ny-1);
    y = ymin:dy:ymax;
    Iy = quad(@kerny,ymin,ymax,1e-9,[]);
    coef = 1 / (2*alpha*sqrt(bet)*Iy);
%end

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

return

function [kern] = kerny(y)

emy = exp(-y);
kern = emy ./ (sqrt(y).*(1+emy).^2);

return

Contact us