# Continuous time likelihood calculation

# Purpose

This document outlines a new form of the likelihood for an epidemic model, using a continuous-time approximation to a discrete Markov process.

# State transition model

Epidemic models are represented as State Transition Models, where at any time in an epidemic individuals are assumed to exist in one of a number of states `s = 1, \dots, S`

connected by directed edges, or transitions, `r=1,\dots,R`

. For example:

```
graph LR;
s1 -- r1 --> s2;
s2 -- r2 --> s3;
s2 -- r3 --> s4;
```

# Notation

Let us assume a `y_{tmr}`

represents the number of events occurring at timepoint `t`

in epidemiological unit `m=1,\dots,M`

of type `r=1,\dots,R`

, where `r`

represents a transition (or edge) in a State Transition Model graph. For convenience, we refer to the **event tensor** `Y`

with shape `[T, M, R]`

.

We represent the number of individuals in each epidemiological unit `m`

at time `t`

in state `s`

as `x_{tms}`

, and refer to a **state tensor** `X`

with shape `[T, M, S]`

.

# Likelihood computation

Consider a timepoint `t`

and state `s`

. Under the (approximate) continuous-time model, the probability of `y_{tmr}`

events transitioning *out* of `s`

via transition `r`

at the end of a time interval `\delta t`

is

`f(y_{tmr} | \lambda_{mr}(t), x_{tms}) = (\lambda_{mr}(t))^{y_{tmr}} \exp \left( -x_{tms}\sum_{r \in o(s)} \lambda_{mr}(t) \delta t \right)`

where `\lambda_{mr}(t)`

is the hazard rate for the `r`

th transition, and `o(s)`

is the set of *outgoing* transitions from state `s`

.

**Remarks**:

- This is essentially survival analysis, where the lifespan function is a product of a hazard rate (
`\lambda_{mr}(t)`

) and survivor function

under the exponential distribution.`S(T > t) = 1 - F(T \leq t) = \exp (-\lambda_{mr}(t) \delta t`