Tutorials › Stochastic Processes › Generator Calculations for Event-Driven Models

Continuous-Time Markov Chains and Generator Matrices · Tutorial 479 of 994

Generator Calculations for Event-Driven Models

Translate event rates into generator actions on functions, then use those actions to calculate drift and other local changes in finite and population models.

Advanced 11 min read

What You'll Learn

  • Write generator actions as sums of event rates times changes in a state function.
  • Aggregate event rates that lead to the same destination state.
  • Calculate generator actions for functions and indicators in a finite event model.
  • Derive drift and second-moment actions for an immigration-death population.
  • Check generator row sums and distinguish local calculations from expectation identities.

From Event Rates to Changes in a Function

In an event-driven model, the state changes when one of several possible events occurs. Each event has a rate that may depend on the current state, and its effect on a function of the state is the difference between the function after the event and before it. Organizing calculations around those differences gives a direct way to obtain generator actions without first solving for the transition probabilities at positive times.

Let \((X_t)_{t\ge0}\) be a continuous-time Markov chain on a finite or countable state space \(S\), defined on a probability space \((\Omega,\mathcal{F},\mathbb{P})\). Use the natural filtration \(\mathcal{F}_t=\sigma(X_s:0\le s\le t)\). Its generator is \(Q=(q_{ij})\), with \(q_{ij}\ge0\) for \(i\ne j\) and rows summing to zero. For a function \(f:S\to\mathbb{R}\), the generator action is

$$ Qf(i)=\sum_{j\in S}q_{ij}f(j) =\sum_{j\ne i}q_{ij}\bigl(f(j)-f(i)\bigr). $$

The second expression follows from \(q_{ii}=-\sum_{j\ne i}q_{ij}\). It emphasizes that a transition matters through its change in \(f\), not just the destination value. On a finite state space the sum is finite. On a countable state space we use the expression when the sum of absolute values of the terms is finite. For unbounded \(f\), a pointwise rate calculation alone does not assert that \(\mathbb{E}_i[f(X_t)]\) is differentiable or that its derivative equals \(\mathbb{E}_i[Qf(X_t)]\); those conclusions require additional conditions.

Definition (Event-rate representation): At state \(i\), suppose there are finitely many event types \(r\), with rate \(a_r(i)\ge0\), and event \(r\) changes the state to \(T_r(i)\in S\). The rate operator acting on \(f\) is the sum of the event rates multiplied by their changes in \(f\). Events that leave the state unchanged contribute zero.

The following result justifies this event-by-event calculation. If several event types lead to the same new state, their rates must be added to obtain the corresponding off-diagonal entry of the generator.

Proposition: For finitely many event types at each state, the generator action represented by their rates is \(Qf(i)=\sum_r a_r(i)\bigl(f(T_r(i))-f(i)\bigr)\). The associated off-diagonal rates are \(q_{ij}=\sum_{r:T_r(i)=j}a_r(i)\) for \(j\ne i\), and \(q_{ii}=-\sum_{j\ne i}q_{ij}\).

Proof. Fix \(i\). For each destination \(j\ne i\), collect all event types \(r\) for which \(T_r(i)=j\), and define \(q_{ij}\) as the sum of their rates. Event types with \(T_r(i)=i\) have zero change in \(f\), so they add nothing. Grouping the remaining terms by destination gives \(\sum_r a_r(i)(f(T_r(i))-f(i))=\sum_{j\ne i}q_{ij}(f(j)-f(i))\). Set \(q_{ii}=-\sum_{j\ne i}q_{ij}\). The row then sums to zero, and \(\sum_{j\in S}q_{ij}f(j)=\sum_{j\ne i}q_{ij}(f(j)-f(i))\). This is precisely the generator action. \(\square\)

A Finite-State Event Model

Consider a system with capacity two. Its state \(i\in\{0,1,2\}\) is the number of items present. Arrivals occur at rate \(2\) when the system is not full, and services occur at rate \(1\) when it is not empty. An arrival increases the state by one; a service decreases it by one. The rates are event rates, not probabilities: for example, the arrival rate \(2\) at state \(0\) does not mean that an arrival has probability \(2\).

Worked Example: Generator Action on the Occupancy

Compute \(Qf\) for the occupancy function \(f(i)=i\). The transition matrix of rates, with rows and columns ordered \(0,1,2\), is

$$ Q= \begin{bmatrix} -2&2&0\\ 1&-3&2\\ 0&1&-1 \end{bmatrix}. $$

Before using it, check the row sums: \(-2+2+0=0\), \(1-3+2=0\), and \(0+1-1=0\). The off-diagonal entries are nonnegative, and each diagonal entry is the negative total rate of leaving that state. With \(f=(0,1,2)^{\mathsf T}\), matrix multiplication gives

$$ Qf= \begin{bmatrix} -2(0)+2(1)+0(2)\\ 1(0)-3(1)+2(2)\\ 0(0)+1(1)-1(2) \end{bmatrix} = \begin{bmatrix}2\\1\\-1\end{bmatrix}. $$

The event calculation gives the same values. At state \(0\), an arrival changes \(f\) by \(1\), so \(Qf(0)=2(1)=2\). At state \(1\), an arrival changes \(f\) by \(1\) and a service by \(-1\), so \(Qf(1)=2(1)+1(-1)=1\). At state \(2\), only service is possible, giving \(Qf(2)=1(-1)=-1\). Thus the local rate of change in occupancy is positive at \(0\) and \(1\), and negative at \(2\).

Check: the computed vector \(Qf=(2,1,-1)^{\mathsf T}\) agrees with the three event-by-event sums. In particular, at state \(1\), the arrival contribution \(2\) and service contribution \(-1\) combine to give \(1\).

Generator actions also apply to indicator functions. For \(f(i)=\mathbf{1}_{\{2\}}(i)\), the value is \(1\) at state \(2\) and \(0\) elsewhere. The action measures the rate of change in this indicator, separating transitions into the target state from transitions out of it.

Worked Example: Rate of Change of a Target-State Indicator

For the same three-state model, calculate \(Qf\) when \(f(i)=\mathbf{1}_{\{2\}}(i)\). The rate matrix has row sums \(-2+2+0=0\), \(1-3+2=0\), and \(0+1-1=0\), so it is a valid generator. The function vector is \(f=(0,0,1)^{\mathsf T}\). Direct multiplication gives

$$ Qf= \begin{bmatrix} -2(0)+2(0)+0(1)\\ 1(0)-3(0)+2(1)\\ 0(0)+1(0)-1(1) \end{bmatrix} = \begin{bmatrix}0\\2\\-1\end{bmatrix}. $$

Equivalently, at state \(0\) no event moves directly into state \(2\), so the action is \(0\). At state \(1\), an arrival enters state \(2\) at rate \(2\) and changes the indicator from \(0\) to \(1\), giving \(2(1)=2\). At state \(2\), a service leaves state \(2\) at rate \(1\) and changes the indicator from \(1\) to \(0\), giving \(1(-1)=-1\).

Check: the indicator action is zero at \(0\), positive at \(1\), and negative at \(2\), as the possible transitions require. The row sums used in the calculation are all zero, as required for a generator.

A Countable-State Population Model

Now let \(S=\{0,1,2,\ldots\}\), where \(X_t\) is a population size. Immigrants arrive at rate \(\lambda>0\), increasing the population by one, and each individual dies independently at rate \(\delta>0\), decreasing the population by one. Thus, at population \(n\), the total immigration rate is \(\lambda\) and the total death rate is \(\delta n\). At \(n=0\) the death rate is zero. Every state has finite total exit rate. The model is nonexplosive: over a finite time interval there are finitely many immigration events almost surely, and, starting with finitely many individuals, each individual can die at most once.

The rates are \(q_{n,n+1}=\lambda\), \(q_{n,n-1}=\delta n\) for \(n\ge1\), and \(q_{n,n}=-(\lambda+\delta n)\), with \(q_{0,0}=-\lambda\). The row at \(0\) sums to \(-\lambda+\lambda=0\). For \(n\ge1\), the row sums to \(\lambda+\delta n-(\lambda+\delta n)=0\). For a function with finite differences at each state, the event formula is

$$ Qf(n)=\lambda\bigl(f(n+1)-f(n)\bigr) +\delta n\bigl(f(n-1)-f(n)\bigr),\qquad n\ge1, $$

and \(Qf(0)=\lambda(f(1)-f(0))\). The death term at zero is omitted, rather than evaluated at a nonexistent state \(-1\).

Proposition: For the immigration-death model, the rate actions on \(f(n)=n\) and \(g(n)=n^2\) are \(Qf(n)=\lambda-\delta n\) and \(Qg(n)=-2\delta n^2+(2\lambda+\delta)n+\lambda\), for all \(n\ge0\).

Proof. For \(n\ge1\), the change in \(f(n)=n\) under immigration is \((n+1)-n=1\), and under death it is \((n-1)-n=-1\). Therefore \(Qf(n)=\lambda(1)+\delta n(-1)=\lambda-\delta n\). At \(n=0\), \(Qf(0)=\lambda(1-0)=\lambda\), also given by the formula. For \(g(n)=n^2\), immigration changes the function by \((n+1)^2-n^2=2n+1\), while death changes it by \((n-1)^2-n^2=-2n+1\). Hence, for \(n\ge1\), \(Qg(n)=\lambda(2n+1)+\delta n(-2n+1)=-2\delta n^2+(2\lambda+\delta)n+\lambda\). At \(n=0\), \(Qg(0)=\lambda(1^2-0^2)=\lambda\), matching the same expression at zero. This proves both formulas on the entire state space. \(\square\)

Worked Example: Drift and Second-Moment Action at Population Three

Take \(\lambda=2\), \(\delta=1\), and evaluate both actions at \(n=3\). The immigration rate is \(2\), the death rate is \(1\cdot3=3\), and the total exit rate is \(2+3=5\). The off-diagonal rates are \(q_{3,4}=2\) and \(q_{3,2}=3\), with \(q_{3,3}=-5\); their row sum is \(2+3-5=0\).

For \(f(n)=n\), immigration changes the function by \(4-3=1\), and death changes it by \(2-3=-1\). Thus

$$ Qf(3)=2(1)+3(-1)=2-3=-1. $$

For \(g(n)=n^2\), the corresponding changes are \(4^2-3^2=16-9=7\) and \(2^2-3^2=4-9=-5\). Therefore

$$ Qg(3)=2(7)+3(-5)=14-15=-1. $$

Check by the formulas: \(Qf(3)=2-1\cdot3=-1\). Also \(Qg(3)=-2(1)(3^2)+(2(2)+1)(3)+2=-18+15+2=-1\). Both formula evaluations match the event calculations.

Interpretation and a Common Mistake

For a function \(f\), \(Qf(i)\) is the rate-weighted sum of changes in \(f\) from state \(i\). In the finite occupancy example, \(Qf(i)\) for \(f(i)=i\) is a local drift calculation. In the population model, \(Qf(n)=\lambda-\delta n\) compares the immigration and death contributions. These are generator actions; interpreting them as derivatives of expected values requires suitable conditions on the process and function. In particular, for an unbounded function such as \(n^2\), finiteness of the pointwise rate sum does not by itself justify interchanging a derivative and expectation.

Common mistake: dropping the diagonal term but also forgetting to subtract the current function value. In the finite model, at state \(1\) with \(f(i)=i\), the incorrect calculation using only off-diagonal entries as \(q_{10}f(0)+q_{12}f(2)\) gives \(1(0)+2(2)=4\). This omits the holding-rate contribution \(q_{11}f(1)=-3\). The correct matrix calculation is \(1(0)-3(1)+2(2)=1\), or, equivalently, the event-difference calculation \(1(0-1)+2(2-1)=-1+2=1\). Use either complete form; do not mix the off-diagonal rates with the matrix formula while omitting its diagonal term.

Event-based calculations are useful whenever a model is specified by mechanisms rather than a complete matrix. For each state, identify every event, its rate, and its effect on the chosen function. If different events lead to the same destination, their rates add in the generator matrix, but their separate contributions to \(Qf\) still sum to the same total. This makes the calculation both systematic and easy to check.

Check Your Understanding

For each question, distinguish the rate calculation from any claim about an expected value over time.

  1. In the capacity-two model, calculate \(Qf(0)\) for \(f(i)=i^2\), showing the event rate and change in function value.
  2. For the same model, calculate \(Qf(1)\) when \(f(i)=\mathbf{1}_{\{0\}}(i)\).
  3. In the immigration-death model, write \(Qf(n)\) for \(f(n)=n\), including the boundary state \(n=0\).
  4. Why must event types that leave the state unchanged contribute zero to the generator action?
  5. What extra care is needed before interpreting \(Qf(n)\) for an unbounded function as a derivative of an expected value?