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

tmakeham_cdf(x, theta, Q1, P1)
% tmakeham_cdf.m - evaluates a Doubly-Truncated Makeham Cumulative Distribution.
%   See "Recurrence Relations Between Moments of Order Statistics from Doubly Truncated Makeham Distribution",
%   Computational & Applied Mathematics, Vol.28, No.3, p.277, 2009.
%   http://www.scielo.br/pdf/cam/v28n3/02.pdf.
%
%  Created by Jim Huntley,  01/25/10
%

function [cdf] = tmakeham_cdf(x, theta, Q1, P1)

%persistent P2

%if(isempty(P2))
    P = 1 - exp(-P1-theta*(P1+exp(-P1)-1));
    Q = 1 - exp(-Q1-theta*(Q1+exp(-Q1)-1));
    P2 = (1-P) / (P-Q);
%end

cdf = 1 + P2 - tmakeham_pdf(x,theta,Q1,P1) ./ (1+theta.*(1-exp(-x)));

return

Contact us