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_pdf(x, theta, Q1, P1)
% tmakeham_pdf.m - evaluates a Doubly-Truncated Makeham Probability Density.
%   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 [pdf] = tmakeham_pdf(x, theta, Q1, P1)

%persistent coef

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

pdf = coef .* (1 + theta*(1-exp(-x))) .* exp(-x-theta.*(x+exp(-x)-1));

return

Contact us