# Notation for Distributions

This defines notation for subsequent sections.

## Notation

First, let's affix notation. The cumulative distribution function of every regular distribution can be written as an integral over its hazard rate, $\lambda$

$$$F(t)=1-e^{-\int_{0}^t \lambda(s)ds}.$$$

All algorithms for stochastic simulation treat distributions as being defined in absolute time, specified as an enabling time, $t_e$,

$$$F(t, t_e)=1-e^{-\int_{0}^{t-t_e} \lambda(s)ds}.$$$

Working with distributions in absolute time is a simple shift of the time scale and will be ignored in further discussions, although the enabling time, $t_e$, will certainly appear in code.

The density function is the derivative of the cumulative distribution function,

$$$f(t)=\frac{dF(t)}{dt}=\lambda(t)e^{-\int_{0}^t \lambda(s)ds}.$$$

The survival is

$$$G(t)=1-F(t)=e^{-\int_{0}^t \lambda(s)ds}.$$$

Because survival is multiplicative, we further label the survival from time $t_0$ to $t_1$ as

$$$G(t_0, t_1)=\frac{G(t_1)}{G(t_0)}=e^{-\int_{t_0}^{t_1} \lambda(s)ds}$$$

## Using Julia's Distributions

Julia's continuous univariate distributions support a common interface.

In this table, d is the distribution, t is the time, and q is a quantile.

Julia callNotation
cdf(d,t)$F(t)$
quantile(d,q)$F^{-1}(q)$
logcdf(d,t)$\ln(F(t))$
ccdf(d,t)$G(t)$
logccdf(d,t)$-\int_0^t \lambda(s)ds$
quantile(d,q)$F^{-1}(q)$
cquantile(d,q)$F^{-1}(1-q)=G^{-1}(q)$
invlogcdf(d,lp)$F^{-1}(e^{l_p})$
invlogccdf(d,lp)$G^{-1}(e^{l_p})$ or $-\int_0^{t(l_p)}\lambda(s)ds=l_p$
randexp(rng)$-\ln(1-U)$