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

devyld_pdf(x, s)
% devyld_pdf.m - evaluates a DeVylder Probability Density.
%   See "DeVylder Approximations to the Moments and Distribution
%   of the Time to Ruin,", D. C. DicKson and K. S. Wong.
%
%  Created by Jim Huntley,  09/22/06
%
%

function [pdf] = devyld_pdf(x, s)

%persistent a a1 a2

%if(isempty(a))
    a = 0.5 + sqrt(0.25-2/(7+s^2));
    a1 = 1 / (1-a);
    a2 = 1 / a1;
%end

pdf = a.*a1.*exp(-a1.*x) + (1-a).*a2.*exp(-a2.*x);

return

Contact us