1 Introduction

Compartmental models are widely used to describe a range of biological and physical processes that rely on mass conservation principles (Anderson 1983; Jacquez and Simon 1993). In particular, most models that describe the carbon cycle can be generalized as compartmental models (Luo and Weng 2011; Sierra and Müller 2015; Rasmussen et al. 2016). These models are very important for predicting interactions between ecosystems and the global climate. However, the predictions of these models diverge widely (Friedlingstein et al. 2006, 2014) since models have different structures and parameter values. To compare diverse models, key quantities such as system age and transit time can be considered. These quantities provide relevant information about the time scales at which material is cycled in compartmental systems and facilitate comparisons among different model structures and parameterizations. Formulas for their means were recently provided by Rasmussen et al. (2016) for linear nonautonomous compartmental systems. For autonomous systems, that is, systems with constant coefficients, the existence of explicit solutions raises hope for explicit formulas not only for the means, but also for the densities of system age and transit time.

A first attempt in this direction was started by Nir and Lewis (1975) who established formulas for transit-time and age densities in dependence on a not explicitly known system response function. This response function was the basis for Thompson and Randerson (1999) to compute the desired densities numerically by long-term simulations in two carbon-cycle models. Impulsive inputs and how systems respond to them were later investigated by Manzoni et al. (2009) to obtain explicitly the system response function for a set of carbon-cycle models of very simple structure. Despite the simple structure of these systems, the derivation of the according density formulas is involved, because the system’s response needs to be transformed from the phase domain to the Laplace domain and back. In this manuscript, the dynamics of linear autonomous compartmental systems are considered as a stochastic process to show that the impulse response function is the probability density function of a phase-type distribution. To this end, open linear autonomous compartmental systems are related to absorbing continuous-time Markov chains.

This manuscript is organized as follows. In Sect. 2, linear autonomous compartmental systems are introduced, and the idea of looking at them from the perspective of one single particle is framed. The transit time of this particle through the system coincides with the absorption time of a continuous-time Markov chain. A short presentation of the basic ideas of continuous-time Markov chains follows in Sect. 3. The probability distribution of the absorption time is shown to be an example of a phase-type distribution, and its cumulative distribution function, probability density function, and moments are computed. In Sect. 4, concepts from renewal theory are used to construct a regenerative process, which is the basis for the computation of the system- and compartment-age densities. The relationship of Markov chains and linear autonomous compartmental systems is established in Sect. 5, where the previous probabilistic results are used to obtain simple explicit formulas for the densities of the system age, compartment age, and transit time. In Sect. 6, the derived formulas are applied to two autonomous terrestrial carbon-cycle models. Both models are considered in steady state, which allows the treatment of a linear model (Emanuel et al. 1981), as well as a nonlinear one (Wang et al. 2014) within the proposed framework. Relations to earlier work and some other aspects are discussed in Sect. 7, and in Sect. 8 conclusions are presented. “Appendix A” contains the proof of the main theorem from Sect. 4, and “Appendix B” covers some examples for systems with simple structure.

2 Linear Autonomous Compartmental Systems

Compartmental differential equations are useful tools to describe flows of material between units called compartments under the constraint of mass conservation. Following Jacquez and Simon (1993), a compartment is an amount of some material that is kinetically homogeneous. This means that the material of a compartment is at all times homogeneous; any material entering the compartment is instantaneously mixed with the material already there. Hence, compartments are always well-mixed.

Consider the d-dimensional linear system of differential equations

$$\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}t}\,\mathbf {x}(t)= & {} {\mathsf {B}}\,\mathbf {x}(t) + \mathbf {u},\quad t>0,\nonumber \\ \mathbf {x}(0)= & {} \mathbf {x^0}\in \mathbb {R}^d. \end{aligned}$$
(1)

This equation system represents how mass flows at time \(t=0\) into a set of compartments, flows and cycles among the compartments, and eventually leaves the system. Therefore, the vector \(\mathbf {x^0}\) of initial contents and the constant input vector \(\mathbf {u}\) are required to have nonnegative entries only. The law of conservation of mass imposes restrictions on the \(d\times d\)-matrix \({\mathsf {B}}\).

Definition 1

A matrix \({\mathsf {B}}=(b_{ij})\in \mathbb {R}^{d\times d}\) is called a compartmental matrix if

  1. (i)

    \(0\le b_{ij}\) for all \(i\ne j\),

  2. (ii)

    \(0\le -b_{jj}<\infty \) for all j,

  3. (iii)

    \(\sum _{i=1}^d b_{ij} \le 0\) for all j.

If now \({\mathsf {B}}\) is a compartmental matrix, (1) is called a linear autonomous compartmental system. The term autonomous refers to the fact that both \({\mathsf {B}}\) and \(\mathbf {u}\) are independent of time t. A detailed treatment of such systems can be found in Anderson (1983) and Jacquez and Simon (1993).

For \(t\ge 0\) the vector \(\mathbf {x}(t)\in \mathbb {R}^d\) represents the contents of the different compartments at time t. The off-diagonal entries \(b_{ij}\) of \({\mathsf {B}}\) are called fractional transfer coefficients. They are the rates at which mass moves from compartment j to compartment i. For \(j=1,\ldots ,d\), the nonnegative value \(z_j=-\sum _{i=1}^d b_{ij}\) is the rate at which mass leaves the system from compartment j. If at least one of these output or release rates is greater than zero, system (1) is called open, otherwise it is called closed. This paper is concerned with open systems only, since closed systems with positive input accumulate mass indefinitely.

2.1 The One-Particle Perspective

Looking at the behavior of the entire system, the initial content \(\mathbf {x^0}\) distorts what can be seen happening to the system content. There are two ways to get rid of this disturbing influence of the initial content. One way is to consider the system after it has run for an infinite time such that all the initial content has left. Another way is to look at one single particle that just arrives at the system through new input \(\mathbf {u}\).

Since all compartments are well-mixed, this particle’s way through the system is not influenced by the presence or absence of any other particles. It enters the system at a compartment according to \(\mathbf {u}\) and then, at each time step, whether it stays or moves on is decided on the basis of its current position and its schedule. If the decision is to move on, then it can move to another compartment or leave the system, depending only on the connections of the current compartment. The particle follows a schedule and a map given by the matrix \({\mathsf {B}}\). Its diagonal entries govern how long the particle stays in a certain compartment, and the off-diagonal entries provide the connections to other compartments. By leaving the system, the particle finishes a cycle and starts a new one by reentering the system. At each cycle, the sequence of compartments to which the particle belongs at successive time steps constitutes a stochastic process called discrete-time Markov chain. Letting the size of the time steps tend to zero, the particle’s future becomes continuously uncertain. The path of the particle traveling through the system is then represented by a continuous-time Markov chain (Norris 1997).

In Sect. 2.2, the structure and properties of continuous-time Markov chains are introduced, and the reader should always have in mind the traveling particle. When the Markov chain changes its state from j to i, the particle is considered to move from compartment j to compartment i. When the Markov chain is absorbed, the particle leaves the system. The time that elapses from the moment the particle enters the system to the moment of its exit is called the particle’s transit time. To get a grasp on it, from the beginning of the cycle only a look into the future is necessary.

While the particle is still in the system, the time that has passed since the particle’s entry is called its system age. If the age of the particle is considered at a random time, a look into the past of the particle is needed, not knowing when it entered the system the last time. Consequently, it has to be assumed that the particle has ran through the system already infinitely often. Otherwise the existence of a maximum age of the particle would be implied, but any choice of this maximum value would be arbitrary and ill-founded. Therefore, a particular regenerative process will be considered: a sequence of absorbing continuous-time Markov chains.

2.2 From One Particle to All Particles in the System

Assume that the system at time \(t\ge 0\) contains n particles with system ages represented by n independent and identically distributed random variables. Hence, the system age \(A_k\) of particle k is assumed to have the cumulative distribution function \(F_A\) for all \(k=1,2,\ldots ,n\). The share of particles with system age less than or equal to \(y\ge 0\) equals

$$\begin{aligned} F_n(y) = \frac{1}{n}\,\sum \limits _{k=1}^n\,\mathbb {1}_{(-\infty , y]}(A_k). \end{aligned}$$

Here, \(\mathbb {1}_S(s)\) denotes the indicator function. It equals 1 if \(s\in S\) and it equals 0 otherwise. The function \(F_n\) is called empirical distribution function of \(A_1,A_2,\ldots , A_n\), and from the Glivenko–Cantelli theorem (Dudley 1999) it is known that it converges almost surely uniformly to \(F_A\) if the number n of particles goes to infinity. Consequently, if the system contains an infinite amount of particles, the share of the total system content \(\mathbf {x}(t)\) that has system age less than or equal to y is

$$\begin{aligned} F_A(y) = \int \limits _0^y f_A(\tau )\,\mathrm{d}\tau , \end{aligned}$$

where \(f_A\) is the common probability density function of the particles’ ages.

3 Continuous-Time Markov Chains

Markov chains are the most important examples of random processes. Given their simple structure and high diversity, they are applied to many different scientific problems. In particular, they are the simplest mathematical models for random phenomena evolving in time. Their characteristic property is that they retain no memory on the states of the system in the past. Only the current state of the process can influence where it goes next. If the process can assume only a finite or countable set of states, it is called a Markov chain. Discrete-time Markov chains are usually defined on a set of integers, whereas continuous-time Markov chains live on a subset of the real line. In the following, the basic theory of continuous-time Markov chains is introduced along the line of Norris (1997), from which also most unproven results are taken.

A vector \({\varvec{\lambda }}\in \mathbb {R}^d\) is called a distribution if all its components are nonnegative and sum to one. Furthermore, a matrix \({\mathsf {P}}=(p_{ij})_{i,j\in J}\) is called stochastic on a finite set J if every column \((p_{ij})_{i\in J}\) is a distribution. Note that in standard literature on Markov chains row sums are considered. Here, column sums are used instead, because thereby the connection to compartmental matrices will become more obvious later. The definition of a Markov chain can best be formalized in terms of its corresponding transition rate matrix. A transition rate matrix is a special compartmental matrix where all columns sum to zero.

Definition 2

Let J be a finite state space. A transition rate matrix on J is a matrix \({\mathsf {Q}}=(q_{ij})_{i,j\in J}\) satisfying the conditions

  1. (i)

    \(0\le q_{ij}\) for all \(i\ne j\),

  2. (ii)

    \(0\le -q_{jj}<\infty \) for all j,

  3. (iii)

    \(\sum _{i\in J} q_{ij} = 0\) for all j.

Each off-diagonal entry \(q_{ij}\) can be interpreted as the rate of going from state j to state i and the diagonal entries \(q_{jj}\) as the rate of leaving state j.

Definition 3

Let \({\mathsf {Q}}\) be a transition rate matrix and \({\varvec{\lambda }}\) a distribution on a finite state space J. A stochastic process \(X=(X_t)_{t\ge 0}\) is a continuous-time Markov chain on J with initial distribution \({\varvec{\lambda }}\) and transition rate matrix \({\mathsf {Q}}\) if

  1. (i)

    \(\mathbb {P}(X_0=j) = \lambda _j\) for all \(j\in J\);

  2. (ii)

    for all \(n=0,1,2,\ldots \), all times \(0\le t_0\le t_1\le \cdots \le t_{n+1}\), and \(j_0,j_1,\ldots ,j_{n+1}\in J\),

    $$\begin{aligned} \mathbb {P}\left( X_{t_{n+1}} = j_{n+1}\,|\,X_{t_0}=j_0,\ldots ,X_{t_n}=j_n\right) =\left( \mathrm{e}^{(t_{n+1}-t_n)\,{\mathsf {Q}}}\right) _{j_{n+1} j_n}, \end{aligned}$$

    where for any quadratic matrix \({\mathsf {M}}\) the expression \(\mathrm{e}^{\mathsf {M}}\) denotes the matrix exponential

    $$\begin{aligned} \mathrm{e}^{\mathsf {M}} = \sum \limits _{k=0}^\infty \frac{{\mathsf {M}}^k}{k!}. \end{aligned}$$

Since \({\mathsf {Q}}\) does not depend on time, X is called homogeneous. Property (ii) states that the future evolution of a Markov process depends only on its current state and not on its history. This is called Markov property.

Let X be a continuous-time Markov chain on J with initial distribution \({\varvec{\lambda }}\) and transition rate matrix \({\mathsf {Q}}\). Then, for \(i,j\in J\), the probability of being in state i at time t having started in state j is equal to

$$\begin{aligned} \mathbb {P}(X_t=i\,|\,X_0=j) = \left( \mathrm{e}^{t\,{\mathsf {Q}}}\right) _{ij}, \end{aligned}$$

and the probability of being in state i at time t (conditioned on the initial distribution \({\varvec{\lambda }}\)) is

$$\begin{aligned} \mathbb {P}(X_t=i)=\left( \mathrm{e}^{t\,{\mathsf {Q}}}\,{\varvec{\lambda }}\right) _i. \end{aligned}$$

3.1 Absorbing Continuous-Time Markov Chains

Consider a continuous-time Markov chain \(X=(X_t)_{t\ge 0}\) with a special structure. Its finite state space J is assumed to be equal to \(\{1,2,\ldots ,d, d+1\}\) for some natural number \(d\ge 1\), and its transition rate matrix has the shape

$$\begin{aligned} {\mathsf {Q}}=\begin{pmatrix} {\mathsf {B}} &{} \mathbf {0} \\ \mathbf {z}^T &{} 0 \end{pmatrix}\in \mathbb {R}^{(d+1)\times (d+1)}. \end{aligned}$$
(2)

Here, \(\mathbf {0}\) is the d-dimensional column vector containing only zeros. Let \(S:=\{1,2,\ldots ,d\}\subseteq J\). The \(d\times d\)-matrix \({\mathsf {B}}=(b_{ij})_{i,j\in S}\) is assumed to meet the requirements (i) and (ii) of a transition rate matrix, but instead of property (iii) of Definition 2 it fulfills only the weaker condition

$$\begin{aligned} \sum \limits _{i\in S} b_{ij} \le 0\quad \text {for all}\quad j\in S. \end{aligned}$$

Since \({\mathsf {Q}}\) is required to be a transition rate matrix, the vector \(\mathbf {z}\in \mathbb {R}^d\) must contain the missing parts to make the columns sum to zero. Consequently, \(z_j=-\sum _{i\in S} b_{ij}\), which in matrix notation is written as

$$\begin{aligned} \mathbf {z}^T = -\mathbf {1}^T\,{\mathsf {B}}, \end{aligned}$$
(3)

where \(\mathbf {1}^T\) denotes the d-dimensional row vector comprising ones. This means that the \(z_j\) are nonnegative and denote the transition rates from j to \(d+1\). The \((d+1)\)st column of \({\mathsf {Q}}\) contains only zeros. Consequently, the process X cannot change its state anymore once it has reached state \(d+1\). For that reason, \(d+1\) is called the absorbing state of X. The trivial case in which the process starts in its absorbing state is excluded by considering only initial distributions \({\varvec{\lambda }}\) with \(\lambda _{d+1}=0\). Then the new initial distribution of X is defined as

$$\begin{aligned} {\varvec{\beta }}:=(\lambda _1,\lambda _2,\ldots ,\lambda _d)^T. \end{aligned}$$
(4)

A standard linear algebra argument shows that

$$\begin{aligned} \mathrm{e}^{t\,{\mathsf {Q}}} = \begin{pmatrix} \mathrm{e}^{t\,{\mathsf {B}}} &{} \mathbf {0} \\ *&{} 1\end{pmatrix},\quad t\ge 0, \end{aligned}$$

where the asterisk \(*\) is a place holder for a d-dimensional row vector. This means for \(i,j\in S\) that

$$\begin{aligned} \mathbb {P}(X_t=i\,|\,X_0=j) = \left( \mathrm{e}^{t\,{\mathsf {B}}}\right) _{ij}, \end{aligned}$$

and

$$\begin{aligned} \mathbb {P}(X_t=i) = \left( \mathrm{e}^{t\,{\mathsf {B}}}\,{\varvec{\beta }}\right) _i. \end{aligned}$$
(5)

3.2 The Absorption Time

The absorption time

$$\begin{aligned} T:=\inf \{t\ge 0:\,X_t=d+1\}\quad (\inf \emptyset :=\infty ), \end{aligned}$$

is a random variable that tells the time when the absorbing state is reached. Another name for it is hitting time of the absorbing state. It is an interesting question whether the absorbing state will always be reached no matter in which state the process starts. The following lemma (Neuts 1981, Lemma 2.2.1) provides an answer to this question.

Lemma 1

If \({\mathsf {B}}\) is nonsingular, then the absorption time T is finite with probability one.

Definition 4

A Markov chain X on \(J = \{1,2,\ldots ,d,d+1\}\) whose transition rate matrix \({\mathsf {Q}}\) has the structure of Eq. (2) and that will eventually be absorbed to \(d+1\) with probability one is called absorbing. The matrix \({\mathsf {B}}\) is called its transition rate matrix, \(S=\{1,2,\ldots ,d\}\) its state space, and \(d+1\) its absorbing state. If \({\varvec{\lambda }}\) denotes the initial distribution of X, then \({\varvec{\beta }}\) as defined in Eq. (4) is called the initial distribution of the absorbing chain.

The following results related to absorbing continuous-time Markov chains will be used in the forthcoming.

Remark 1

For an absorbing continuous-time Markov chain eventual absorption is certain, independent of the initial state. Hence,

$$\begin{aligned} \lim _{t\rightarrow \infty }\,\mathbb {P}(X_t=i\,|\,X_0=j)=\lim _{t\rightarrow \infty }\,\left( \mathrm{e}^{t\,{\mathsf {B}}}\right) _{ij}=0,\quad i,j\in S. \end{aligned}$$

Lemma 2

If \({\mathsf {B}}\) is nonsingular, then

$$\begin{aligned} \int \limits _0^\infty \mathrm{e}^{t\,{\mathsf {B}}}\,\mathrm{d}t = -{\mathsf {B}}^{-1}. \end{aligned}$$
(6)

Remark 2

Since \({\mathsf {Q}}\) is a transition rate matrix, \(\mathrm{e}^{t\,{\mathsf {Q}}}\) is stochastic. This makes all of its entries and hence all entries of \(\mathrm{e}^{t\,{\mathsf {B}}}\) nonnegative. From Eq. (6) it follows that also all entries of \(-{\mathsf {B}}^{-1}\) are nonnegative.

From now on, let \({\mathsf {B}}\) be the nonsingular transition rate matrix of an absorbing continuous-time Markov chain \(X=(X_t)_{t\ge 0}\) on \(S=\{1,2,\ldots ,d\}\) with initial distribution \({\varvec{\beta }}\) and absorbing state \(d+1\). As it turns out, the absorption time T follows a phase-type distribution that depends on the initial distribution \({\varvec{\beta }}\) and on the transition rate matrix \({\mathsf {B}}\).

3.2.1 Probability Distributions of Phase-Type

Phase-type distributions constitute a highly versatile class of probability distributions and are closely related to the solutions of systems of linear differential equations with constant coefficients. As mixtures of exponential distributions, they generalize the Erlang, hypoexponential, and hyperexponential distribution. These are widely used in queuing theory and the field of renewal processes. An introduction to phase-type distributions and the unifying matrix formalism used in this paper can be found in Neuts (1981).

At time t, the cumulative distribution function \(F_T(t)=\mathbb {P}(T\le t)\) of the absorption time T is equal to the probability of not being in any of the states \(j\in S\). Consequently, using Eq. (5) leads to

$$\begin{aligned} F_T(t)=1-\sum \limits _{j\in S} \mathbb {P}(X_t=j) =1-\mathbf {1}^T\,\mathrm{e}^{t\,{\mathsf {B}}}\,{\varvec{\beta }},\quad t\ge 0. \end{aligned}$$

Using \(\mathbf {z}^T=-\mathbf {1}^T\,{\mathsf {B}}\) from Eq. (3), the probability density function is

$$\begin{aligned} f_T(t) = \mathbf {z}^T\, \mathrm{e}^{t\,{\mathsf {B}}}\,{\varvec{\beta }},\quad t\ge 0. \end{aligned}$$
(7)

A probability distribution according to this density is called phase-type with initial distribution \({\varvec{\beta }}\) and transition rate matrix \({\mathsf {B}}\). Neuts (1981) introduced the notation \(T\sim {\text {PH}}({\varvec{\beta }},{\mathsf {B}})\).

3.2.2 Moments of the Phase-Type Distribution

Let \(T\sim {\text {PH}}({\varvec{\beta }},{\mathsf {B}})\) with nonsingular \({\mathsf {B}}\) and \(\mathbf {z}^T=-\mathbf {1}^T\,{\mathsf {B}}\). Lemma 2 can be used to calculate the nth moment of the phase-type distribution. Repeated integration by parts leads to

$$\begin{aligned} \mathbb {E}\left[ T^n\right] = \int \limits _0^\infty t^n\,f_T(t)\,\mathrm{d}t = (-1)^n\,n!\,\mathbf {1}^T\, {\mathsf {B}}^{-n}\,{\varvec{\beta }}. \end{aligned}$$

In particular, the first moment of the phase-type distribution is

$$\begin{aligned} \mathbb {E}[T] = -\mathbf {1}^T\, {\mathsf {B}}^{-1}\,{\varvec{\beta }} = \Vert {\mathsf {B}}^{-1}\,{\varvec{\beta }}\Vert , \end{aligned}$$
(8)

where \(\Vert \mathbf {v}\Vert :=\sum _{j=1}^d |v_j|\) denotes the norm of a vector \(\mathbf {v}\in \mathbb {R}^d\). The last equality holds since both the matrix \(-{\mathsf {B}}^{-1}\) and the vector \({\varvec{\beta }}\) are nonnegative. For \(-{\mathsf {B}}^{-1}\) this follows from Remark 2 and for \({\varvec{\beta }}\) because it is a distribution.

Note that the variance, that is the second central moment, of the phase-type distribution can be obtained from \(\sigma ^2_T = \mathbb {E}[T^2] - (\mathbb {E}[T])^2\).

3.2.3 A Closure Property of the Phase-Type Distributions

The class of phase-type distributions has several closure properties, one of which is given by the following lemma (Neuts 1981, Theorem 2.2.3).

Lemma 3

If \(T\sim {\text {PH}}({\varvec{\beta }},{\mathsf {B}})\), then a random variable with cumulative distribution function

$$\begin{aligned} F(t) = \frac{1}{\mathbb {E}[T]}\,\int \limits _0^t \left[ 1-F_T(\tau )\right] \,\mathrm{d}\tau , \end{aligned}$$

is phase-type distributed with initial distribution

$$\begin{aligned} {\varvec{\eta }}=\frac{-{\mathsf {B}}^{-1}\,{\varvec{\beta }}}{\Vert {\mathsf {B}}^{-1}\,{\varvec{\beta }}\Vert }, \end{aligned}$$

and transition rate matrix \({\mathsf {B}}\).

3.3 Occupation Time

Before its absorption, X takes on different states \(j\in S\). Its occupation time of state j is defined as the time the process spends in state j. It is given as the nonnegative random variable

$$\begin{aligned} O_j := \int \limits _0^\infty \mathbb {1}_{\{X_t=j\}}\,\mathrm{d}t. \end{aligned}$$

Using \(\mathbb {E}[\mathbb {1}_{X_t=j}]=\mathbb {P}(X_t=j)\) and Eq. (6), its expected value can be computed to

$$\begin{aligned} \mathbb {E}\left[ O_j\right] = \left( -{\mathsf {B}}^{-1}\,{\varvec{\beta }}\right) _j. \end{aligned}$$

In particular, \((-{\mathsf {B}}^{-1})_{ij}\) is the mean time the Markov chain is in state i before absorption, under the condition that it started in state j.

3.4 The Last State Before Absorption

Let E denote the state from which X jumps to the absorbing state. From the homogeneity of X follows

$$\begin{aligned} \mathbb {P}(E=j)=z_j\,\mathbb {E}[O_j], \end{aligned}$$
(9)

where \(O_j\) is the occupation time of state j.

4 A Regenerative Process

Assume that an absorbing continuous-time Markov chain is restarted immediately every time it hits the absorbing state. The goal of this section is to determine the distribution of the age of this new process at a random time \(\tau \) drawn from the positive half-line (technical details on \(\tau \) are presented in “Appendix A”). Age means here the time that has passed since the last restart.

First, the new situation is set up, then the distribution of the age at a random time is derived, and as a last step the age distribution at a random time under the condition of being in a fixed state is computed. Important tools are elements from renewal theory such as renewal and regenerative processes. A comprehensive treatise of this topic can be found in Asmussen (2003).

4.1 Definition of the Regenerative Process

Let X be an absorbing continuous-time Markov chain on a finite state space J with transition rate matrix \({\mathsf {B}}\) and initial distribution \({\varvec{\beta }}\). Now, the process X is stopped at its absorption time T, an immediate restart is executed, and this procedure is repeated over and over again. This gives an infinite sequence \((X^k)_{k=1,2,\ldots }\) of independent and identically distributed cycle processes, where each cycle process behaves like the process X up to absorption. This sequence constitutes a regenerative process \(Z=(Z_t)_{t\ge 0}\) with \(Z_t=X^k_t\) for \(t\in [T_{k-1},T_k)\), where \(T_0:=0\). The process that counts the number of restarts is called a renewal process.

A regenerative process is called alternating, if it has only the two possible states 1 and 0. Let \(Y = (Y_t)_{t\ge 0}\) be an arbitrary alternating regenerative process with the same cycle lengths as Z, that is \(Y_t = Y^k_t\) for \(t\in [T_{k-1},T_k)\). The alternating process Y is called on at time t if \(Y_t=1\), otherwise it is called off. Note that \(X^k_t\) and \(Y^k_t\) are defined to be zero if \(t\notin [T_{k-1},T_k)\). Such alternating processes together with the following theorem build the main tool for the computation of the age distributions.

Theorem 1

The probability that an alternating process Y with the same cycle lengths as Z is on at a random time \(\tau \ge 0\) equals the ratio of expected on-time during the first cycle to the average cycle length. This leads to

$$\begin{aligned} P(Y_\tau =1) = \frac{1}{\mathbb {E}[T]}\,\mathbb {E}\int \limits _0^\infty \mathbb {1}_{\{Y^1_t=1\}}\,\mathrm{d}t. \end{aligned}$$

Despite the intuitive nature of this result, its proof requires quite some technical effort and it is postponed to “Appendix A”.

4.2 The Age of the Regenerative Process

Consider the age process \((A_t)_{t\ge 0}\) defined such that the random variable \(A_t\) describes the time that has passed by t since the last restart. It is also called backward recurrence time of the renewal process. It can be considered the age of the regenerative process Z at time t. For \(y\ge 0\) and a randomly chosen time \(\tau \), the probability \(F_{A_\tau }(y)=\mathbb {P}(A_\tau \le y)\) is to be computed.

To obtain that probability, an alternating process Y is constructed that is on at time t if and only if the time elapsed since the last restart is less than or equal to y. Obviously, \(\mathbb {P}(A_\tau \le y) = \mathbb {P}(Y_\tau =1)\). Taking into account that \(Y^1_t=1\) if and only if \(t<T_1\) and \(t\le y\), it follows that

$$\begin{aligned} \mathbb {E}\int \limits _0^\infty \mathbb {1}_{\{Y^1_t=1\}}\,\mathrm{d}t = \mathbb {E}\int \limits _0^y\mathbb {1}_{\{t<T_1\}}\,\mathrm{d}t = \int \limits _0^y \mathbb {P}(T>t)\,\mathrm{d}t = \int \limits _0^y [1-F_T(t)]\,\mathrm{d}t. \end{aligned}$$

Write A instead of \(A_\tau \) and apply Theorem 1 to the alternating process Y to obtain the cumulative distribution function

$$\begin{aligned} F_A(y) = \frac{1}{\mathbb {E}[T]}\,\int \limits _0^y[1-F_T(t)]\,\mathrm{d}t,\quad y\ge 0, \end{aligned}$$
(10)

of the age of the regenerative process Z. Hence, this age is again phase-type distributed by Lemma 3, now with initial probability vector \({\varvec{\eta }}\).

4.3 The Age of the Regenerative Process in a Fixed State

Fix \(j\in S\) and let \(a_j\) be the random variable that describes the age of the process Z given that it is in state j. For \(y\ge 0\) this means

$$\begin{aligned} \mathbb {P}(a_j\le y) = \mathbb {P}(A_\tau \le y\,|\,Z_\tau =j). \end{aligned}$$

The conditional probability on the right hand side can be expressed as

$$\begin{aligned} \mathbb {P}(A_\tau \le y\,|\,Z_\tau =j) = \frac{\mathbb {P}(A_\tau \le y,\,Z_\tau =j)}{\mathbb {P}(Z_\tau =j)}. \end{aligned}$$
(11)

The numerator and the denominator can be computed using two alternating processes Y and \(\tilde{Y}\), respectively. The process Y is defined to be on at time t if and only if \(A_t\le y\) and \(Z_t=j\), whereas \(\tilde{Y}\) is defined to be on if and only if Z is in state j. Invoke Theorem 1 to Y and \(\tilde{Y}\) to get

$$\begin{aligned} \mathbb {P}(A_\tau \le y,\,Z_\tau =j) = \frac{1}{\mathbb {E}[T]}\,\int \limits _0^y\mathbb {P}(X_t=j)\,\mathrm{d}t, \end{aligned}$$
(12)

and

$$\begin{aligned} \mathbb {P}(Z_\tau =j) = \frac{\mathbb {E}[O_j]}{\mathbb {E}[T]}, \end{aligned}$$
(13)

respectively.

By plugging Eq. (12) for the numerator and Eq. (13) for the denominator in Eq. (11), the cumulative distribution function of \(a_j\) is given by

$$\begin{aligned} F_{a_j}(y) = \frac{1}{\mathbb {E}[O_j]}\,\int \limits _0^y\mathbb {P}(X_t=j)\,\mathrm{d}t,\quad y\ge 0. \end{aligned}$$

This means that the probability density function of the age of Z in state j is given by

$$\begin{aligned} f_{a_j}(y) = \frac{\mathbb {P}(X_y=j)}{\mathbb {E}[O_j]} = \frac{\left( \mathrm{e}^{y\,{\mathsf {B}}}\,{\varvec{\beta }}\right) _j}{\left( -{\mathsf {B}}^{-1}\,{\varvec{\beta }}\right) _j},\quad y\ge 0. \end{aligned}$$
(14)

5 Compartmental Systems and Markov Chains

Consider again the linear autonomous compartmental system (1) and the \((d+1)\times (d+1)\)-matrix

$$\begin{aligned} {\mathsf {Q}} = \begin{pmatrix} {\mathsf {B}} &{} \mathbf {0} \\ \mathbf {z}^T &{} 0\end{pmatrix}. \end{aligned}$$

Owing to the properties of \({\mathsf {B}}\) and \(\mathbf {z}=(z_j)_{j=1,2,\ldots ,d}\), the extended matrix \({\mathsf {Q}}\) meets Definition 2. Consequently, it is the transition rate matrix of a continuous-time Markov chain \(X=(X_t)_{t\ge 0}\) on the state space \(J=\{1,2,\ldots ,d,d+1\}\).

Assume that mass \(\mathbf {u}\in \mathbb {R}^d\) comes into system (1) at a time \(t_0\). Since the system is linear, the way how the mass will be distributed through it can be modeled by a system without input and with initial value \(\mathbf {u}\) given by

$$\begin{aligned} \begin{aligned} \frac{\mathrm{d}}{\mathrm{d}t}\,\tilde{\mathbf {x}}(t)&= {\mathsf {B}}\,\tilde{\mathbf {x}}(t),\quad t>t_0,\\ \tilde{\mathbf {x}}(t_0)&= \mathbf {u}. \end{aligned} \end{aligned}$$
(15)

Furthermore, the fractional transfer coefficients of this system are time independent, so the entire system can be shifted to the left and considered to have started at time \(t_0=0\). The content of compartment j at time \(t\ge 0\) is then given by \(\tilde{x}_j(t)=\left( \mathrm{e}^{t\,{\mathsf {B}}}\,\mathbf {u}\right) _j\).

Let

$$\begin{aligned} {\varvec{\lambda }}:=\frac{1}{\Vert \mathbf {u}\Vert }\,\left( u_1,u_2,\ldots ,u_d,0\right) ^T, \end{aligned}$$

and \({\varvec{\beta }}:=(\lambda _1,\lambda _2,\ldots ,\lambda _d)^T\). Then the probability of the continuous-time Markov chain X with initial distribution \({\varvec{\beta }}\) being in state \(j\in S:=\{1,2,\ldots ,d\}\) at time t is by an application of Eq. (5) given by

$$\begin{aligned} \mathbb {P}(X_t=j)=\left( \mathrm{e}^{t\,{\mathsf {B}}}\,{\varvec{\beta }}\right) _j = \frac{\tilde{x}_j(t)}{\Vert \mathbf {u}\Vert }. \end{aligned}$$

\(\mathbb {P}(X_t=j)\) is the proportion of the initially present mass of system (15) that is in compartment j at time t. Consequently, the continuous-time Markov chain X describes the stochastic travel of a single particle through the compartmental system. When the traveling particle leaves the compartmental system, the process X jumps to the absorbing state \(d+1\).

5.1 Global Asymptotic Stability

Assume the compartmental matrix \({\mathsf {B}}\) to be nonsingular. Then the constant vector \(\mathbf {x}^*= -{\mathsf {B}}^{-1}\,\mathbf {u}\) is a steady-state solution or equilibrium of system (1), that is, \(\mathrm{d}\,\mathbf {x}^*/\mathrm{d}t = \mathbf {0}\).

Any solution \(\mathbf {x}\) of the linear system (1) has the form (Anderson 1983)

$$\begin{aligned} \mathbf {x}(t) = \mathrm{e}^{t\,{\mathsf {B}}}\,\mathbf {x^0} + \int \limits _0^t \mathrm{e}^{(t-\tau )\,{\mathsf {B}}}\,\mathbf {u}\,\mathrm{d}\tau ,\quad t\ge 0. \end{aligned}$$

If \(t\rightarrow \infty \), an application of Eq. (6) and Remark 1 leads to

$$\begin{aligned} \lim \limits _{t\rightarrow \infty } \mathbf {x}(t) = -{\mathsf {B}}^{-1}\,\mathbf {u} + \lim \limits _{t\rightarrow \infty } {\mathsf {B}}^{-1}\,\mathrm{e}^{t\,{\mathsf {B}}}\,\mathbf {u}= -{\mathsf {B}}^{-1}\,\mathbf {u}, \end{aligned}$$

which means that all solutions of system (1) converge to \(\mathbf {x}^*\), independently of their initial value \(\mathbf {x^0}\). This makes the equilibrium \(\mathbf {x}^*=-{\mathsf {B}}^{-1}\,\mathbf {u}\) globally asymptotically stable and by the classic Lyapunov theorem (Engel and Nagel 2000, Theorem 2.10) all eigenvalues of \({\mathsf {B}}\) have negative real part.

It is well known that system (1) is globally asymptotically stable, if \({\mathsf {B}}\) is strictly diagonally dominant, that is \(\sum _{i=1}^d b_{ij}<0\) for all \(j\in S\). However, here \({\mathsf {B}}\) is not strictly diagonally dominant (it is diagonally dominant, though), but it is a nonsingular compartmental matrix. This means that \({\mathsf {B}}\) is the transition rate matrix of an absorbing continuous-time Markov chain. For the absorbing state to be reached eventually, at least one rate \(z_j=-\sum _{i=1}^d b_{ij}\) of leaving the system from compartment j must be strictly greater than zero. This makes system (1) an open system (Jacquez and Simon 1993).

5.2 Steady-State Compartment Contents

For \(j\in S\) the steady-state content of compartment j is \(x^*_j=-\left( {\mathsf {B}}^{-1}\,\mathbf {u}\right) _j\). Plugging in \({\varvec{\beta }}=\mathbf {u}/\Vert \mathbf {u}\Vert \) gives

$$\begin{aligned} \frac{x^*_j}{\Vert \mathbf {u}\Vert } = -\left( {\mathsf {B}}^{-1}\,{\varvec{\beta }}\right) _j\ = \mathbb {E}[O_j]. \end{aligned}$$
(16)

Consequently, the steady-state compartment content \(x_j^*\) is proportional to the expected occupation time of state j by the absorbing continuous-time Markov chain X.

5.3 Release from the System

For \(j\in S\), the release of mass from compartment j to the environment is denoted by \(r_j\). As a function of time t, it can be computed as product of the rate \(z_j\) of mass leaving compartment j toward the environment and the mass \(x_j(t)\) contained in compartment j at time t. For a system in steady state, \(x_j(t)=x_j^*\) remains constant and consequently \(r_j=z_j\,x_j^*\) remains constant as well.

Let now \(\mathbf {r}=(r_1,r_2,\ldots ,r_d)^T\in \mathbb {R}^d\) be the vector of mass release or output from the system in steady state. Probabilistically, one would expect \(r_j\) to be connected to the probability of the absorbing continuous-time Markov chain X to be absorbed through state j. From Eq. (9) the probability of j being the last state before absorption is \(\mathbb {P}(E=j)=-z_j\,\left( {\mathsf {B}}^{-1}\,{\varvec{\beta }}\right) _j\). Use \({\varvec{\beta }}=\mathbf {u}/\Vert \mathbf {u}\Vert \) and \(\mathbf {x}^*=-{\mathsf {B}}^{-1}\,\mathbf {u}\) to get

$$\begin{aligned} \mathbb {P}(E=j) = z_j\,x_j^*\,\frac{1}{\Vert \mathbf {u}\Vert }=\frac{r_j}{\Vert \mathbf {u}\Vert }. \end{aligned}$$

This means that the release through compartment j is proportional to the probability of X being absorbed through state j. Since absorption is certain, \(\sum _{j\in S}\mathbb {P}(E=j) = 1\), hence \(\Vert \mathbf {r}\Vert =\sum _{j\in S} r_j = \Vert \mathbf {u}\Vert \), reflecting that in steady state total system output equals total system input.

5.4 Age Distribution of the System in Steady State

Suppose that the total system content in steady state has an unknown age density \(f_A\). In Sect. 4.2, it was already considered a particle that travels over and over again through the system, and its age at a random time was computed by methods from renewal theory. The according regenerative process expresses the need for an infinite history. Consequently, it reflects the behavior of the compartmental system in steady state, when all initial mass has left the system.

The age random variable A was shown to be phase-type distributed with transition rate matrix \({\mathsf {B}}\) and initial distribution

$$\begin{aligned} {\varvec{\eta }}=\frac{-{\mathsf {B}}^{-1}\,{\varvec{\beta }}}{\Vert {\mathsf {B}}^{-1}\,{\varvec{\beta }}\Vert } = \frac{\Vert \mathbf {u}\Vert }{\Vert \mathbf {u}\Vert }\,\frac{-{\mathsf {B}}^{-1}\,\mathbf {u}}{\Vert {\mathsf {B}}^{-1}\,\mathbf {u}\Vert } = \frac{\mathbf {x}^*}{\Vert \mathbf {x}^*\Vert }. \end{aligned}$$

Thus, the density is given by Eq. (7) with \({\varvec{\eta }}\) replacing \({\varvec{\beta }}\). This gives the density

$$\begin{aligned} f_A(y)=\mathbf {z}^T\,\mathrm{e}^{y\,{\mathsf {B}}}\,{\varvec{\eta }} = \mathbf {z}^T\,\mathrm{e}^{y\,{\mathsf {B}}}\,\frac{\mathbf {x}^*}{\Vert \mathbf {x}^*\Vert },\quad y\ge 0. \end{aligned}$$
(17)

The mean age of the system can be obtained from Eq. (8) as

$$\begin{aligned} \mathbb {E}[A]=-\mathbf {1}^T\,{\mathsf {B}}^{-1}\,{\varvec{\eta }} = \frac{\Vert {\mathsf {B}}^{-1}\,\mathbf {x}^*\Vert }{\Vert \mathbf {x}^*\Vert }. \end{aligned}$$
(18)

5.5 Age Distribution of the Compartments in Steady State

Now, suppose that compartment \(j\in S\) has an unknown age density \(f_{a_j}\). In Sect. 4.3 the age of the regenerative process Z was calculated under the condition that its state equals j. This is the age that a traveling particle has when it is in compartment j. From Eq. (14) and \(\mathbf {x}^*=-{\mathsf {B}}^{-1}\,\mathbf {u}\), it follows that

$$\begin{aligned} f_{a_j}(y) = \frac{1}{x^*_j}\,\left( \mathrm{e}^{y\,{\mathsf {B}}}\,\mathbf {u}\right) _j. \end{aligned}$$

Integration by parts gives then for the mean age in compartment \(j\in S\) the equation

$$\begin{aligned} \int \limits _0^\infty y\,f_{a_j}(y)\,\mathrm{d}y = \frac{1}{x^*_j}\,\left( {\mathsf {B}}^{-2}\,\mathbf {u}\right) _j = -\frac{1}{x^*_j}\,\left( {\mathsf {B}}^{-1}\,\mathbf {x}^*\right) _j. \end{aligned}$$

Defining \({\mathsf {X^*}}:={\text {diag}}(x^*_1,\ldots ,x^*_d)\), this gives a vector valued function of age densities in the compartments

$$\begin{aligned} \mathbf {f_a}(y) = ({\mathsf {X^*}})^{-1}\,\mathrm{e}^{y\,{\mathsf {B}}}\,\mathbf {u},\quad y\ge 0, \end{aligned}$$

and its expectation

$$\begin{aligned} \mathbb {E}[\mathbf {a}] = -({\mathsf {X^*}})^{-1}\, {\mathsf {B}}^{-1}\,\mathbf {x}^*, \end{aligned}$$
(19)

is the vector of mean ages in the compartments. It is called mean age vector.

For \(n\ge 1\) let \(\mathbf {a}^n\) denote the vector \((a_1^n,\ldots ,a_d^n)^T\). Multiple integration by parts leads to a formula for the vector whose components contain the nth moments of the compartment ages. It is given by

$$\begin{aligned} \mathbb {E}[\mathbf {a}^n] = (-1)^n\,n!\,({\mathsf {X^*}})^{-1}\, {\mathsf {B}}^{-n}\,\mathbf {x}^*. \end{aligned}$$

Note that a computation of the average of the components of the mean age vector weighted by the respective steady-state compartment contents leads to the same equation for the mean system age as calculating the expected value of \({\text {PH}}({\varvec{\eta }}, {\mathsf {B}})\) as it was done to obtain Eq. (18).

5.6 Transit Time in Steady State

For compartmental systems two types of transit times can be considered (Nir and Lewis 1975). The forward transit time (\({\text {FTT}}\)) at time \(t_a\) is the time t a particle needs to travel through the system after it arrives at time \(t_a\). The backward transit time (\({\text {BTT}}\)) at time \(t_e\) gives the age y a particle has at the moment it leaves the system, that is, the time it needed to travel through the system given that it exits at time \(t_e\). For an autonomous system in steady state one would expect the two types of transit time to coincide.

Obviously, the \({\text {FTT}}\) is the absorption time of the absorbing continuous-time Markov chain X. As soon as the traveling particle leaves the system, X hits its absorbing state. Hence, the \({\text {FTT}}\) is phase-type distributed with initial distribution \({\varvec{\beta }}\) and transition rate matrix \({\mathsf {B}}\). This makes its density function

$$\begin{aligned} f_{{\text {FTT}}}(t) = \mathbf {z}^T\,\mathrm{e}^{t\,{\mathsf {B}}}\,{\varvec{\beta }},\quad t\ge 0, \end{aligned}$$

and its mean

$$\begin{aligned} \mathbb {E}[{\text {FTT}}] = \Vert {\mathsf {B}}^{-1}\,{\varvec{\beta }}\Vert =\frac{\Vert \mathbf {x}^*\Vert }{\Vert \mathbf {u}\Vert }. \end{aligned}$$
(20)

For the \({\text {BTT}}\) the above constructed regenerative process can be considered. The \({\text {BTT}}\) is the age of Z at the time of a restart. Hence, it follows the same distribution as the cycle length and is identically distributed to the absorption time. So, from the probabilistic point of view, \({\text {FTT}}\) and \({\text {BTT}}\) are obviously the same. But the density of the \({\text {BTT}}\) can also be calculated as a weighted average of ages of particles that are leaving the system by

$$\begin{aligned} f_{{\text {BTT}}}(y) = \frac{1}{\Vert \mathbf {r}\Vert }\,\sum \limits _{j\in S} r_j\,f_{a_j}(y) = \frac{1}{\Vert \mathbf {u}\Vert }\,\sum \limits _{j\in S} \frac{z_j\,x^*_j}{x_j^*}\,\left( \mathrm{e}^{y\,{\mathsf {B}}}\,\mathbf {u}\right) _j = \mathbf {z}^T\,\mathrm{e}^{y\,{\mathsf {B}}}\,{\varvec{\beta }},\quad y\ge 0. \end{aligned}$$

Intuition does not betray in this case: \({\text {FTT}}\) and \({\text {BTT}}\) coincide in steady state. Furthermore, the transit time depends neither on the arrival time \(t_a\) nor on the exit time \(t_e\).

6 Application to Carbon Cycle Models

6.1 A Linear Autonomous Compartmental System in Steady State

As an example, consider the global carbon-cycle model introduced by Emanuel et al. (1981), for which Thompson and Randerson (1999) numerically calculated age and transit-time distributions using the impulse response function approach. This model is therefore a good test-case for the derivations presented above. It comprises five compartments: non-woody tree parts \(x_1\), woody tree parts \(x_2\), ground vegetation \(x_3\), detritus/decomposers \(x_4\), and active soil carbon \(x_5\). The model is given by

$$\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}t}\mathbf {x}(t) = {\mathsf {B}}\,\mathbf {x}(t) + \mathbf {u},\quad t>0, \end{aligned}$$
(21)

where the input vector is given by \(\mathbf {u} = \left( \begin{matrix}77&0&36&0&0\end{matrix}\right) ^T\,\hbox {Pg}\,\hbox {C}\,\hbox {year}^{-1}\) and the compartmental matrix by

$$\begin{aligned} {\mathsf {B}} = \left( \begin{matrix} -77/37 &{} 0 &{} 0 &{} 0 &{} 0\\ 31/37 &{} -31/452 &{} 0 &{} 0 &{} 0\\ 0 &{} 0 &{} -36/69 &{} 0 &{} 0\\ 21/37 &{} 15/452 &{} 12/69 &{} -48/81 &{} 0\\ 0 &{} 2/452 &{} 6/69 &{} 3/81 &{} -11/1121 \end{matrix}\right) \,\hbox {year}^{-1}. \end{aligned}$$

The numbers are chosen exactly as in Thompson and Randerson (1999). For comparison of the results, also refer to that paper. The input vector is expressed in units of petagrams of carbon per year (\(\hbox {Pg}\,\hbox {C}\,\hbox {year}^{-1}\)), and the fractional transfer coefficients in units of \(\hbox {year}^{-1}\). Because \({\mathsf {B}}\) is a lower triangular matrix with diagonal entries different from zero, it is nonsingular and all the earlier obtained formulas can be applied to system (21). The steady-state vector of carbon contents is

$$\begin{aligned} \mathbf {x}^*= -{\mathsf {B}}^{-1}\,\mathbf {u} = \left( \begin{matrix}37.00&452.00&69.00&81.00&1121.00\end{matrix}\right) ^T\,\hbox {Pg}\,\hbox {C}, \end{aligned}$$

which results in a vector for the fractions of total carbon storage equal to

$$\begin{aligned} \left( \begin{matrix}2.10&25.68&3.92&4.60&63.69\end{matrix}\right) ^T\,\%. \end{aligned}$$

The respiration vector in steady state is

$$\begin{aligned} \mathbf {r} = \left( z_j\,x_j^*\right) _{j=1,2,\ldots ,5}=\left( \begin{matrix}25.00&14.00&18.00&45.00&11.00\end{matrix}\right) ^T\,\hbox {Pg}\,\hbox {C}\,\hbox {year}^{-1}. \end{aligned}$$

That gives fractions of total respirations as

$$\begin{aligned} \left( \begin{matrix}22.12&12.39&15.93&39.82&9.73\end{matrix}\right) ^T\,\%. \end{aligned}$$

The transit time T is phase-type distributed with probability density function (Fig. 1)

$$\begin{aligned} f_T(t)&= 0.31\,\mathrm{e}^{-77/37\,t} + 0.02\,\mathrm{e}^{-31/452\,t} + 0.52\,\mathrm{e}^{-36/69\,t}\\&\quad -0.30\,\mathrm{e}^{-48/81\,t} + 0.001\,\mathrm{e}^{-11/1121\,t}. \end{aligned}$$

The expected value \(\mathbb {E}[T] = 15.58\,\hbox {year}\) is identical to the value found by Thompson and Randerson (1999), and the standard deviation of the transit time is \(\sigma _T = 45.01\,\hbox {year}\).

Fig. 1
figure 1

The probability density function of the transit time T of the model by Emanuel et al. (1981). Its shape and the low value of \(f_T\) at mean time \(\mu =15.58\,\hbox {year}\) are evidence for a long tail of this distribution. The standard deviation of T is denoted by \(\sigma \)

Furthermore, the system-age density is given by

$$\begin{aligned} f_A(y)&= 0.01\,\mathrm{e}^{-77/37\,y} + 0.02\,\mathrm{e}^{-31/452\,y} + 0.06\,\mathrm{e}^{-36/69\,y} \\&\quad - 0.03\,\mathrm{e}^{-48/81\,y} + 0.001\,\mathrm{e}^{-11/1 121\,y}. \end{aligned}$$

Its expectation \(\mathbb {E}[A] = 72.83\,\hbox {year}\) is very similar to that reported by Thompson and Randerson (1999) (72.82 year), with standard deviation \(\sigma _A = 94.18\,\hbox {year}\).

Additionally, the vector that contains the probability density functions for the age in the compartments can be calculated as

$$\begin{aligned} \mathbf {f_a}(y) = \left( \begin{matrix} 2.08 &{} 0 &{} 0 &{} 0 &{} 0\\ -0.07 &{} 0.07 &{} 0 &{} 0 &{} 0\\ 0 &{} 0 &{} 0.52 &{} 0 &{} 0\\ -0.35 &{} 0.03 &{} 1.1 &{} -0.76 &{} 0\\ 0.0005 &{} -0.003 &{} -0.01 &{} 0.004 &{} 0.01 \end{matrix}\right) \, \left( \begin{matrix} e^{-77/37\,y}\\ e^{-31/452\,y}\\ e^{-36/69\,y}\\ e^{-48/81\,y}\\ e^{-11/1121\,y} \end{matrix}\right) , \end{aligned}$$

from which the mean age vector is given by

$$\begin{aligned} \mathbb {E}[\mathbf {a}] = \left( \begin{matrix}0.48&15.06&1.92&7.08&107.62\end{matrix}\right) ^T\,\hbox {year}, \end{aligned}$$

and the standard deviation vector by

$$\begin{aligned} {{\varvec{\sigma }}_{\mathbf {a}}} = \left( \begin{matrix}0.48&14.59&1.92&10.64&102.38\end{matrix}\right) ^T\,\hbox {year}. \end{aligned}$$

From these density functions the system’s and the compartments’ contents can be plotted with respect to their age (Fig. 2). This gives useful information about the range of ages for each compartment and how they contribute to the system-age distribution. In comparison to the results of Thompson and Randerson (1999), the approach presented here not only provides mean values for ages and transit times, but also exact formulas for their probability distribution. In their approach, these authors obtained results that depended on the simulation time and, therefore, included numerical errors, something that can be easily avoided with the approach presented here.

Fig. 2
figure 2

Carbon content with respect to age in the model of Emanuel et al. (1981). Dotted lines indicate the mean age \(\mu \); the standard deviation is denoted by \(\sigma \). The first panel is for the entire system, whereas the other panels correspond to the different compartments

6.2 A Nonlinear Autonomous Compartmental System in Steady State

Consider the nonlinear autonomous compartmental system

$$\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}t} \mathbf {x}(t) = B(\mathbf {x}(t))\,\mathbf {x}(t) + \mathbf {u}, \quad t>0, \end{aligned}$$
(22)

where \(B:\mathbb {R}^d\rightarrow \mathbb {R}^{d\times d}\) is a matrix-valued mapping. In this setup the fractional transfer coefficients are not constant but depend on the system’s content. Consequently, the transition rates of the traveling particle are not constant.

Assume now that system (22) is in a steady state \(\mathbf {x}^*\). From \(\mathrm{d}\,\mathbf {x}^*/\mathrm{d}t = 0\) follows that the compartment contents \(x_j\) do not change and the mapping B turns into a matrix \({\mathsf {B}}\) with constant coefficients. Hence, assuming the nonlinear autonomous compartmental system (22) is in a steady state, it can be treated as a linear autonomous compartmental system and the entire theory developed for those systems can be applied to it.

As an example, consider the nonlinear two-compartment carbon-cycle model described by Wang et al. (2014). It is given by

$$\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}t}\,\left( \begin{matrix}C_{s}\\ C_{b}\end{matrix}\right) = \left( \begin{matrix}- \lambda (\mathbf {x}) &{} \mu _{b}\\ \varepsilon \lambda (\mathbf {x}) &{} - \mu _{b}\end{matrix}\right) \, \left( \begin{matrix}C_{s}\\ C_{b}\end{matrix}\right) + \left( \begin{matrix}F_{npp}\\ 0\end{matrix}\right) . \end{aligned}$$

Here, B depends on \(\mathbf {x}=\left( \begin{matrix}C_{s}&C_{b}\end{matrix}\right) ^T\) through \(\lambda \)’s dependence on \(\mathbf {x}\), which is given by

$$\begin{aligned} \lambda (\mathbf {x}) = \frac{C_{b} V_{s}}{C_{s} + K_{s}}. \end{aligned}$$
(23)

Steady-state formulas for the compartment contents can be computed as

$$\begin{aligned} C_s^*= \frac{K_{s}}{\frac{V_{s} \varepsilon }{\mu _{b}} - 1}\quad \text { and }\quad C_b^*= \frac{F_{npp}}{\mu _{b} \left( -1 + \frac{1}{\varepsilon }\right) }. \end{aligned}$$

From Wang et al. (2014) take the parameter values \(F_{npp} = 345\,\hbox {g}\,\hbox {C}\,\hbox {m}^{-2}\,\hbox {year}^{-1}\), \(\mu _b = 4.38\,\hbox {year}^{-1}\), \(\varepsilon = 0.39\), and \(K_s = 53{,}954.83\,\hbox {g}\,\hbox {C}\,\hbox {m}^{-2}\). Since the description of \(V_s\) is missing in the original publication, let it be equal to \(59.13\,\hbox {year}^{-1}\) to approximately meet the given steady-state compartment contents \(C_s^*= 12,650\,\hbox {g}\,\hbox {C}\,\hbox {m}^{-2}\) and \(C_b^*= 50.36\, \hbox {g}\,\hbox {C}\,\hbox {m}^{-2}\).

Fig. 3
figure 3

Transit time and age distributions for the model of Wang et al. (2014). Vertical dashed lines represent the mean \(\mu \); the standard deviation is denoted by \(\sigma \). All panels show graphs for two different values of carbon use efficiency

With the given parameters, the steady-state transition rate matrix \({\mathsf {B}}=B(\mathbf {x}^*)\) and the input vector \(\mathbf {u}\) are given by

$$\begin{aligned} {\mathsf {B}} = \left( \begin{matrix}-0.0447 &{} 4.38\\ 0.0174 &{} -4.38\end{matrix}\right) \,\hbox {year}^{-1} \quad \text {and}\quad \mathbf {u} = \left( \begin{matrix}345\\ 0\end{matrix}\right) \, \hbox {g}\,\hbox {C}\,\hbox {m}^{-2}\,\hbox {year}^{-1}. \end{aligned}$$

The derived formulas are then used to calculate mean transit time and mean ages together with the according densities for different values of the model’s parameters (Fig. 3). In particular, the effect of different values of the parameter \(\varepsilon \) on the steady-state ages and transit times can be explored. This parameter controls the proportion of carbon that is transferred from the substrate \(C_s\) to the microbial biomass compartment \(C_b\), and it is commonly referred to as the carbon use efficiency. Interestingly, if the carbon use efficiency \(\varepsilon \) increases, the mean transit time and mean ages of the model at steady state decrease (Fig. 4), a behavior that at first glance appears counterintuitive. It can be explained by two opposing effects. On the one hand, an increase of carbon use efficiency keeps a higher fraction of carbon in the system due to lower respiration. This has an increasing effect on the transit time. On the other hand, a higher carbon use efficiency \(\varepsilon \) implies a lower steady-state content of compartment \(C_s\) and a higher one of compartment \(C_b\). Consequently, from Eq. (23), an increasing value of

$$\begin{aligned} \lambda (\mathbf {x}^*) = \frac{F_{npp} V_{s}}{\mu _{b} \left( -1 + \frac{1}{\varepsilon }\right) \left( K_{s} + \frac{K_{s}}{\frac{V_{s} \varepsilon }{\mu _{b}} - 1}\right) } \end{aligned}$$

is obtained. This value is the process rate of the \(C_s\) compartment in steady state. The higher it is, the faster the particles travel through the system. The latter effect wins here and a decrease in the transit time can be observed.

Fig. 4
figure 4

Mean transit time (MTT) and mean system age (MSA) in dependence on carbon use efficiency for the proposed model by Wang et al. (2014). The small figure shows the explosion of the mean transit time if the carbon use efficiency tends to one

The graph of the mean system age for this model with \(\varepsilon = 0.39\) (Fig. 4) lies directly on the one of the mean transit time. The huge difference in the compartments’ steady-state contents causes very little difference in the initial distributions \({\varvec{\beta }}\) and \({\varvec{\eta }}\) for the traveling particle. This results in very similar distributions of transit time and system age.

7 Discussion

Simple, explicit, and general formulas for the densities, higher order moments, and first moments for the transit time, system age, and age vector of open linear autonomous compartmental systems were derived. They can be found in different places in this manuscript. For convenience, Table 1 provides a quick overview. Furthermore, a small Python package for linear autonomous compartmental models, called LAPM, is provided on https://github.com/MPIBGC-TEE/LAPM. It deals with symbolic and numerical computations of the formulas given in Table 1.

Table 1 Overview of derived formulas for open linear autonomous compartmental systems \(\frac{\mathrm{d}}{\mathrm{d}t}\,\mathbf {x}(t)={\mathsf {B}}\,\mathbf {x}(t)+\mathbf {u}\)

7.1 Relation to Earlier Results

Over many years compartmental models with fixed coefficients have been studied (Anderson 1983; Bolin and Rodhe 1973; Eriksson 1971) by mainly investigating the mean age of particles in the system and the mean transit time of particles. The topic became of increasing interest again with the need for modeling the terrestrial carbon cycle.

The general situation of linear nonautonomous compartmental models was investigated by Rasmussen et al. (2016). For the special case of autonomous systems they provide the formulas (19), (18), and (20) for the mean age vector, mean system age, and mean transit time, respectively. The probabilistic approach used here showed that these formulas are just expected values of corresponding random variables with according probability distributions \(\mathbf {f_a}(y) = -({\mathsf {X}}^*)^{-1}\, \mathrm{e}^{y\,{\mathsf {B}}}\,\mathbf {u}\), \(A\sim {\text {PH}}({\varvec{\eta }},{\mathsf {B}})\), and \(T\sim {\text {PH}}({\varvec{\beta }}, {\mathsf {B}})\). In particular, the terms mean system age and mean transit time refer to the expected absorption times of related continuous-time Markov chains. A general formula for the moments of the distribution of the transit time in a compartmental system without external inputs is given by Hearon (1972). He also states a formula for the backward transit-time density in this situation.

Manzoni et al. (2009) (also Priestley 1982; Thompson and Randerson 1999) calculated a so-called transfer function or impulse response function \(\varPsi \) that describes the relative contribution of the input at time \(t-T\) to the output at time t. They furthermore give a survivor function

$$\begin{aligned} \tilde{A}(t) = \int \limits _t^\infty \varPsi (T)\,\mathrm{d}T, \end{aligned}$$

that describes the probability of the particle to remain in the system for at least a time t. In the present setup this means

$$\begin{aligned} \tilde{A}(t) = 1-F_T(t), \end{aligned}$$

which leads by

$$\begin{aligned} 1-F_T(t) = \int \limits _t^\infty f_T(t)\,\mathrm{d}t \end{aligned}$$

to the conclusion that the impulse response function \(\varPsi \) is nothing else than the probability density function \(f_T\) of a phase-type distribution \({\text {PH}}({\varvec{\beta }},{\mathsf {B}})\) given by Eq. (7). They also formally provided an age density distribution

$$\begin{aligned} \varphi (t) = \frac{\tilde{A}(t)}{\int \limits _0^\infty \tilde{A}(\tau )\,\mathrm{d}\tau } = \frac{\tilde{A}(t)}{\overline{T}}, \end{aligned}$$

which is exactly the probability density function \(f_A\) of the system age given by Eq. (17). This becomes obvious from Eq. (10), which perfectly relates the distributions of transit time and system age.

For special cases of simple compartmental systems, they further provide formulas for the densities and means of transit time and system age. These formulas were obtained by simulating an impulsive input and considering the impulse response in the Laplace space. It turns out that those formulas are special cases of the general shape of probability density functions of phase-type. Examples are presented in “Appendix B”.

7.2 Singular Compartmental Matrices

In this paper, only nonsingular compartmental or transition rate matrices were considered, because they ensure that every particle that enters the system will eventually leave it. It can be shown (Neuts 1981) that the transit time of a continuous-time Markov chain with singular transition rate matrix does not lead to a certainly finite transit time. In this case, the system contains traps from which particles are not able to get out once they have entered them. So, some particles will remain in the system forever. Although this seems unrealistic, there are successful carbon-cycle models with this structure.

A famous example is the RothC model (Jenkinson and Rayner 1977). It contains an inert compartment that has neither inputs nor outputs, but it has a positive constant content. To apply the stochastic framework of the present paper to that model, it is necessary to cut this compartment out of the system and to look at the steady state of the remaining smaller system. The transit time of newly arriving particles will not be affected. However, the age distribution of the system will depend on time since the particles in the inert compartment become older and older. A detailed analysis of how to treat systems with traps can be found in Jacquez and Simon (1993) and references therein.

7.3 Stochastic Versus Deterministic Approach

As noted by Purdue (1979), in modeling ecological systems, there are powerful arguments for the use of stochastic processes. Even if nature is completely deterministic, ecological systems are too complex for a complete theoretical understanding or descriptive tools. This lack of complete knowledge can be accounted for by using probabilistic methods. One of the first authors to integrate stochastic behavior in biological models was Bartholomay (1958). Purdue (1979) gives an early review on stochastic compartmental models with ecological applications. He showed how compartmental models can be considered as a deterministic representation of an underlying stochastic process by establishing the link to continuous-time Markov chains. While Eisenfeld (1979) elaborates on this link and applies it to a liver model, the present paper connects the continuous-time Markov chain approach to the theory of phase-type distributions (Neuts 1981) and focuses on transit time and ages.

The deterministic theory describes the ideal or average behavior of a system, whereas stochastic models can examine the deviations from such ideal or average behavior. The stochastic approach allows to think of key quantities as random variables. Knowledge of their probability distributions provides a whole new set of tools not only to study the mean, but also higher order moments of such random variables. A high variance of the transit time, for example, expresses that it is not the usual behavior of particles to travel through the system as long as indicated by the mean transit time. There is rather a large variety of different transit times depending on the particular path taken by the particle. Long tails of the distribution mean that there are in fact particles that need very long to travel through the system and hence there are very old masses in the system. With the probability density functions in hand, it is also possible to think of quantiles and confidence intervals of transit time and system age, something not possible with the deterministic approach.

Linear autonomous compartmental carbon-cycle models relate to continuous-time Markov chains with homogeneous transition probabilities. Turning to nonautonomous models (Rasmussen et al. 2016), nonhomogeneous Markov chains would have to be considered in the probabilistic approach. In this situation the Kolmogorov equations govern the evolution of the transition probabilities. There is plenty of theory available on continuous-time Markov chains (Norris 1997; Ross 2010), and much of it might be applied to carbon-cycle models.

8 Conclusions

Open linear autonomous compartmental systems were modeled by absorbing continuous-time Markov chains and it was shown that the behavior of those systems is governed by the phase-type distribution. It applies for the transit time as well as for the system age, only with different initial distributions. This knowledge provides simple general formulas for the densities, means, and higher order moments of transit time, compartment ages, and system age. Furthermore, it explains the underlying structure of the intrinsic connection between system age and transit time (Bolin and Rodhe 1973).

This approach also revealed the potential and opportunities of expressing deterministic compartmental models as stochastic processes. For example, important system diagnostics in reservoir theory such as system ages and transit times have analogous counterparts in probabilistic terms. The theory of stochastic processes can further help to address important questions in reservoir theory with applications in other fields even beyond global biogeochemical cycles.