numeric_average#

View page source

Numerical Approximation of Average Integrands#

Average Noise Effect#

This technique is also used to compute the average noise effect .

A#

We compute an average integrand over a rectangular region defined as

[ age_lower , age_upper ] x [ time_lower , time_upper ]

by the data_table or the avgint_table . Given a data table index or avgint table index \(i\), this section describes the numerical method used to approximate the average integrand A_i is calculated. The index \(i\) is fixed and not included in the discussion below.

ODE#

Some integrands require solution of the Ordinary Differential Equation ; see ODE . The ODE is solved along cohort lines, i.e., lines where time minus age is constant.

Initial Age#

We use the notation \(a_I\) for the age corresponding to initial prevalence pini .

Rectangle#

We use the following notation for the lower and upper limits corresponding to one point in the data_table or avgint_table :

a_L#

We use \(a_L\) to denote the corresponding age_lower value.

a_U#

We use \(a_U\) to denote the corresponding age_upper value.

t_L#

We use \(t_L\) to denote the corresponding time_lower value.

t_U#

We use \(t_U\) to denote the corresponding time_upper value.

Average Integrand Time Step, Delta t#

The average integrand time step \(\Delta t\) is specified by ode_step_size in the option table.

Extended Age Grid#

The extended age grid is the union (as sets) of \(\{ a_L , a_U \}\) and the Age Average Grid .

Cohort Solution of ODE#

A cohort solution is identified by its initial time, corresponding to age \(a_I\), and final age, corresponding to the last point in the solution. The cohort is solved by approximating to rates in the ODE as constant between grid points in the extended age grid.

Time Line#

We use \(\{ a_0 , \ldots , a_{J-1} \}\) be the set of ages in the extended age grid that satisfy \(a_L < a_j < a_U\). Furthermore, these ages are in order; i.e., \(a_j < a_{j+1}\). For each such age, there is a time line interval \([ t_L , t_U ]\) which we refer to as the j-th time line.

S_j#

The j-th time line has a set of times, \(S_j\), in the interval \([ t_L , t_U ]\). We initialize this set as empty. The steps below specify which times get added to \(S_j\). If the ODE is required for this integrand, the steps also specify how the ODE is solved for age \(a_j\) and all the times in \(S_j\).

Lower Time Cohorts#

For each time line index \(j\), the time point \(t_L\) is added to \(S_j\).

ODE#

If the ODE is required for this integrand, it is solved for the cohort corresponding to initial time \(t_L - ( a_j - a_I)\).

  1. If \(t_L + a_U - a_j < t_U\), the final age for this cohort is \(b_j = a_U\). In this case the lower time cohort has not reached the upper time.

  2. If \(t_L + a_U - a_j \geq t_U\), the final age is \(b_j\) is the largest age in the extended age grid such that \(t_L + b_j - a_j \leq t_U\).

For each extended age grid \(a_k\) in the cohort, such that \(a_L \leq a_k \leq b_j\), the time \(t_L + a_k - a_j\) is added to \(S_k\) (because we have the corresponding ODE solution). It may happen by chance that \(t_L + b_j - a_j = t_U\) in which case \(t_U\) is in \(S_j\).

Upper Time Cohorts#

These operations are only done when \(t_L < t_U\). For each time line index \(j\), the time point \(t_U\) is added to \(S_j\).

ODE#

If the ODE is required for this integrand, and \(t_U\) is not in \(S_j\), the ODE is solved for the cohort corresponding to initial time \(t_U - ( a_j - a_I)\) and final age \(a_j\).

  1. For each extended age grid point \(a_k\) in the cohort, such that \(a_L \leq a_k \leq a_j\), and \(t_L \leq t_U - ( a_j - a_k )\), the time \(t_U - ( a_j - a_k )\) is added to \(S_k\).

Refinement#

ODE Not Required#

If the ODE is not required for this integrand, the smallest integer \(N \geq 1\) is chosen so that \((t_U - t_L) / N \leq \Delta t\). If \(N > 1\), For \(j = J-1 , \ldots , 0\), for \(n = 1 , \ldots , n-1\), the point \(t_n = ( t_U - t_L ) / N\) is added to \(S_j\). If \(N > 1\), each \(S_j\) ends up with \(N+2\) time points.

ODE Required#

If the ODE is required for this integrand, the following method is used for refinement of the time lines:

  1. Find the value of \(j\) such that \(t_n - t_{n-1}\) is maximal where \(t_0 < t_1 < \ldots t_{N-1}\) denote the set of times currently in \(S_j\).

  2. If \(t_n - t_{n-1} \leq \Delta t\) we are done with the refinement; i.e., exit this procedure.

  3. Let \(t_M = (t_{n+1} - t_n ) / 2\) and choose \(k\) so that \(a_k\) is in the extended grid and \(a_k\) is as large as possible with \(t_M + a_k - a_j \leq t_U\). Solve the ODE for the cohort with initial time index \(t_M - ( a_j - a_I )\) and final age \(a_k\).

  4. For each index \(\ell \leq k\) such that \(a_L \leq a_\ell\) and \(t_L \leq t_M + a_\ell - a_j\), the time \(t_M + a_\ell - a_j\) is added to \(S_\ell\).

  5. Go to Step 1.

w(a, t)#

We use \(w(a, t)\) to denote a weighting function for this average and define

\[\bar{w} = \int_{a(L)}^{a(U)} \int_{t(L)}^{t(U)} w( a , t) \; \B{d} t \; \B{d} a\]

Note that if \(w(a, t)\) is one, \(\bar{w} = ( a_U - a_L ) ( t_U - t_L )\).

g(a, t)#

We use \(g(a, t)\) to denote the function that is averaged, with respect to age and time, in the definition of \(A\); i.e.,

\[A = \frac{1}{ \bar{w} } \int_{a(L)}^{a(U)} \int_{t(L)}^{t(U)} w(a, t) g( a , t) \; \B{d} t \; \B{d} a\]

Time Integration#

Define the notation \(w \cdot g(a, t) = w(a, t) g(a, t)\). Let \(t_0 < t_1 < \ldots t_{N-1}\) denote the set \(S_j\) at which we are given the function values \(g( a_j , t_i )\). Note that \(t_0 = t_L\) and \(t_{N-1} = t_U\). If \(t_U = t_L\), define \(W( a_j ) = w( a_j , t_0 )\) and \(G( a_j ) = w \cdot g( a_j , t_0 )\). Otherwise we define the approximations

\[W( a_j ) = \sum_{i=1}^{i=N-1} \frac{w( a_j , t_{i-1} ) + w( a_j , t_i )}{2} ( t_i - t_{i-1} ) \approx \int_{t(L)}^{t(U)} w( a_j , t) \; \B{d} t\]
\[G( a_j ) = \sum_{i=1}^{i=N-1} \frac{w \cdot g( a_j , t_{i-1} ) + w \cdot g( a_j , t_i )}{2} ( t_i - t_{i-1} ) \approx \int_{t(L)}^{t(U)} w \cdot g ( a_j , t) \; \B{d} t\]

Age Integration#

We are given the values \(W( a_j )\) and \(G( a_j )\). If \(a_U = a_L\), we approximate \(A \approx G( a_0 ) / W( a_0 )\). Otherwise we define the following approximation for \(A\)

\[\bar{W} = \sum_{j=1}^{j=J-1} \frac{ W( a_{j-1} ) + W( a_j ) }{2} ( a_j - a_{j-1} )\]
\[A \approx \frac{1}{ \bar{W} } \sum_{j=1}^{j=J-1} \frac{ G( a_{j-1} ) + G( a_j ) }{2} ( a_j - a_{j-1} )\]