From 4a8bafba5436d5346d64cf419f10d13bcbbdbc41 Mon Sep 17 00:00:00 2001 From: Aaron Sheldon Date: Wed, 15 Apr 2020 00:10:21 -0600 Subject: [PATCH] Github does not honor operatorname #2 --- src/vonFoersterHazards.ipynb | 40 +++++++++++++++--------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/src/vonFoersterHazards.ipynb b/src/vonFoersterHazards.ipynb index 881983f..fa016aa 100644 --- a/src/vonFoersterHazards.ipynb +++ b/src/vonFoersterHazards.ipynb @@ -19,13 +19,13 @@ "The canonical von Foerster relationship states that for a stochastic process on age $a$ and time $t$ the infinitesimal generator of probability is the kernel of the evolution of the expectation. Formally, given the [hazard rate](https://en.wikipedia.org/wiki/Hazard_ratio) $h$ of the stopping time statistic $A$ of an age dependent stochastic process:\n", "\n", "$$\n", - "\\operatorname{\\mathbb{P}}\\left[ A = a \\parallel A \\ge a \\right] = h\n", + "\\mathbb{P}\\left[ A = a \\parallel A \\ge a \\right] = h\n", "$$\n", "\n", "and the conditional expectation of the density of states occupancy statistic $N$:\n", "\n", "$$\n", - "\\operatorname{\\mathbb{E}}\\left[N \\parallel A=a, T=t \\right]=n\n", + "\\mathbb{E}\\left[N \\parallel A=a, T=t \\right]=n\n", "$$\n", "\n", "the hazard rate $h$ is the kernel of the [von Foerster forward evolution operator](https://en.wikipedia.org/wiki/Von_Foerster_equation) acting on the expected density of states occupancy $n$ along the age $a$ and time $t$ diagonal:\n", @@ -37,7 +37,7 @@ "For a general population the hazard rate is a matrix of transition rates with fixed column sums $\\vec{1}^\\dagger H = 0$, ensuring local conservation of probability. Thus, the transitions of the density of states occupancy statistics vector $\\vec{N}$ from density of state occupancy vector $\\vec{m}$ to the density of state occupancy vector $\\vec{n}$ the yields a hazard rate matrix:\n", "\n", "$$\n", - "\\operatorname{\\mathbb{P}}\\left[ T = t, \\vec{N} = \\vec{n} \\parallel T \\ge t, \\vec{N} = \\vec{m} \\right] = H\n", + "\\mathbb{P}\\left[ T = t, \\vec{N} = \\vec{n} \\parallel T \\ge t, \\vec{N} = \\vec{m} \\right] = H\n", "$$\n", "\n", "In turn the, possibly inhomogeneous, hazard rate matrix determines the evolution of the density of states occupancy vector field:\n", @@ -50,16 +50,10 @@ "\n", "## Methods\n", "\n", - "In general when we are unable to observe or model every transition, such as when the integral of the hazard rate is taken over a duration larger than the smallest [characteristic dwelling time](https://en.wikipedia.org/wiki/Relaxation_%28physics%29) of the states, the probability density matrix requires calculation of the [adjoint derivative](https://en.wikipedia.org/wiki/Derivative_of_the_exponential_map) of the cumulative probability matrix, where the dot is the [currying](https://en.wikipedia.org/wiki/Currying) application of the [adjoint operator](https://en.wikipedia.org/wiki/Adjoint_representation):\n", + "In general when we are unable to observe or model every transition, such as when the integral of the hazard rate is taken over a duration larger than the smallest [characteristic dwelling time](https://en.wikipedia.org/wiki/Relaxation_%28physics%29) of the states, the probability density matrix requires calculation of the [adjoint derivative](https://en.wikipedia.org/wiki/Derivative_of_the_exponential_map) of the cumulative probability matrix, where the dot is the [currying](https://en.wikipedia.org/wiki/Currying) application of the [adjoint operator](https://en.wikipedia.org/wiki/Adjoint_representation) $ad_X Y=XY-YX$ to the parenthesized hazard rate $H$:\n", "\n", "$$\n", - "ad_X Y=XY-YX\n", - "$$\n", - "\n", - "to the parenthesized hazard rate $H$:\n", - "\n", - "$$\n", - "\\operatorname{\\mathbb{P}}\\left[ T_{i \\rightarrow j} = t \\right] = \\left[ \\frac{e^{-ad_{\\int_0^t H ds} \\cdot} - 1}{ad}{}_{\\int_0^t H ds} \\cdot} \\right] \\left(H\\right) e^{- \\int_0^t H ds}\n", + "\\mathbb{P}\\left[ T_{i \\rightarrow j} = t \\right] = \\left[ \\frac{e^{-ad_{\\int_0^t H ds} \\cdot} - 1}{ad_{\\int_0^t H ds} \\cdot} \\right] \\left(H\\right) e^{- \\int_0^t H ds}\n", "$$\n", "\n", "Fortunately if the duration of integration is sufficiently short so that we are capturing every transition we can exploit the observation that the von Foerster operator evolves the continuous density of states $\\vec{n}$ along the fixed age $a$ and time $t$ diagonal to discretize the evolution operator on an equal [finite element](https://en.wikipedia.org/wiki/Finite_element_method) scale of one day in age and time $\\Delta a = \\Delta t = 1 \\text{ day}$:\n", @@ -72,8 +66,8 @@ "\n", "$$\n", "\\begin{array}{rcl}\n", - " n_{i \\rightarrow j} & = & \\operatorname{\\mathbb{E}}\\left[ N_{i \\rightarrow j} \\parallel T_{i \\rightarrow j} \\le \\Delta t \\right]\\\\\n", - " & = & n_i \\operatorname{\\mathbb{P}}\\left[ T_{i \\rightarrow j} \\le \\Delta t \\right]\\\\\n", + " n_{i \\rightarrow j} & = & \\mathbb{E}\\left[ N_{i \\rightarrow j} \\parallel T_{i \\rightarrow j} \\le \\Delta t \\right]\\\\\n", + " & = & n_i \\mathbb{P}\\left[ T_{i \\rightarrow j} \\le \\Delta t \\right]\\\\\n", " & = & n_i \\frac{h_{i \\rightarrow j}}{h_{i \\rightarrow i}}e^{-h_{i \\rightarrow i} \\Delta t}\n", "\\end{array}\n", "$$\n", @@ -84,10 +78,10 @@ "\n", "$$\n", "\\begin{array}{rcl}\n", - " \\operatorname{\\mathbb{C}ov}\\left[ N_{i \\rightarrow j}, N_{i \\rightarrow k} \\parallel T_{i \\rightarrow j} = T_{i \\rightarrow k} \\le \\Delta t \\right]\n", + " \\mathbb{C}ov\\left[ N_{i \\rightarrow j}, N_{i \\rightarrow k} \\parallel T_{i \\rightarrow j} = T_{i \\rightarrow k} \\le \\Delta t \\right]\n", " & = & \n", " n_i \\frac{h_{i \\rightarrow j}}{h_{i \\rightarrow i}} \\frac{h_{i \\rightarrow k}}{h_{i \\rightarrow i}}e^{-2 h_{i \\rightarrow i} \\Delta t}\\\\\n", - " \\operatorname{\\mathbb{V}ar}\\left[N_{i \\rightarrow i} \\parallel T_{i \\rightarrow i} \\le \\Delta t \\right]\n", + " \\mathbb{V}ar\\left[N_{i \\rightarrow i} \\parallel T_{i \\rightarrow i} \\le \\Delta t \\right]\n", " & = &\n", " n_i e^{-h_{i \\rightarrow i} \\Delta t} \\left( 1 - e^{-h_{i \\rightarrow i} \\Delta t} \\right)\n", "\\end{array}\n", @@ -97,14 +91,14 @@ "\n", "$$\n", "\\begin{array}{rcl}\n", - " \\operatorname{\\mathbb{C}ov}\\left[ N_i, N_j \\parallel T \\le \\Delta t \\right] \n", + " \\mathbb{C}ov\\left[ N_i, N_j \\parallel T \\le \\Delta t \\right] \n", " & = &\n", - " \\displaystyle\\sum_{\\delta t=0}^{\\Delta t} \\sum_{k} \\operatorname{\\mathbb{C}ov}\\left[ N_{k \\rightarrow i}, N_{k \\rightarrow j} \\parallel T_{k \\rightarrow i} = T_{k \\rightarrow j} = \\delta t \\right]\\\\\n", + " \\displaystyle\\sum_{\\delta t=0}^{\\Delta t} \\sum_{k} \\mathbb{C}ov\\left[ N_{k \\rightarrow i}, N_{k \\rightarrow j} \\parallel T_{k \\rightarrow i} = T_{k \\rightarrow j} = \\delta t \\right]\\\\\n", " & = &\n", " \\displaystyle \\sum_{\\delta t=0}^{\\Delta t} \\sum_{k} n_k^{\\left( \\delta t \\right)} \\frac{h_{k \\rightarrow i} h_{k \\rightarrow j}}{h_{k \\rightarrow k}} e^{-2 h_{k \\rightarrow k} \\delta t}\\\\\n", - " \\operatorname{\\mathbb{V}ar}\\left[ N_i \\parallel T = \\Delta t \\right] \n", + " \\mathbb{V}ar\\left[ N_i \\parallel T = \\Delta t \\right] \n", " & = &\n", - " \\displaystyle\\sum_{\\delta t=0}^{\\Delta t} \\operatorname{\\mathbb{V}ar}\\left[N_{i \\rightarrow i} \\parallel T_{i \\rightarrow i} = \\delta t \\right]\\\\\n", + " \\displaystyle\\sum_{\\delta t=0}^{\\Delta t} \\mathbb{V}ar\\left[N_{i \\rightarrow i} \\parallel T_{i \\rightarrow i} = \\delta t \\right]\\\\\n", " & = &\n", " \\displaystyle\\sum_{\\delta t=0}^{\\Delta t} n_i^{\\left( \\delta t \\right)} e^{-h_{i \\rightarrow i} \\delta t} \\left( 1 - e^{-h_{i \\rightarrow i} \\delta t} \\right)\n", "\\end{array}\n", @@ -318,13 +312,13 @@ "The ageing acceleration parameter $\\alpha$ can be either positive or negative. Heuristically exacerbation processes are positive, while recovery processes are negative. For example, hospitalizations increase exponentially with age, while discharges decrease exponentially with age, that is increasing length of hospital stay. Gompertz processes theoretically arise in the asymptotic limit of infinitesimal stochastic accelerations of time. Accelerated failure time as a model of biological response to environmental stresses has been rigorously validated in high throughput basic science experiments on [Caenorhabditis elegans ](https://www.nature.com/articles/nature16550). In turn the experimental validation of accelerated failure times gives a parsimonious model for transient infections. Given a background hazard rate $h\\left(a\\right)$:\n", "\n", "$$\n", - "\\operatorname{\\mathbb{P}}\\left[ A = a \\parallel A \\ge a \\right] = h\\left(a\\right)\n", + "\\mathbb{P}\\left[ A = a \\parallel A \\ge a \\right] = h\\left(a\\right)\n", "$$\n", "\n", "The statistical impact of an illness is to accelerate the stopping time by a factor of $\\gamma \\gt 1$, which by differentiating the cumulative probability by age $a$ yields the relationship:\n", "\n", "$$\n", - "\\operatorname{\\mathbb{P}}\\left[ A = \\gamma a \\parallel A \\ge \\gamma a \\right] = \\gamma h\\left(\\gamma a\\right)\n", + "\\mathbb{P}\\left[ A = \\gamma a \\parallel A \\ge \\gamma a \\right] = \\gamma h\\left(\\gamma a\\right)\n", "$$\n", "\n", "The combination of Gompertz processes and accelerated failure time models greatly simplify the construction of communicable disease models because, given a priori estimates of the background parameters, only the single acceleration parameter $\\gamma$ needs to be estimated, and then applied to the background dynamics as an age $a$ and hazard $h$ multiplier.\n", @@ -348,7 +342,7 @@ "$$\n", "\\begin{array}{rcl}\n", " e^{-\\int_0^{\\delta t} h da} & = & e^{-h \\delta t}\\\\\n", - " & = & \\operatorname{\\mathbb{P}}\\left[T \\gt \\delta t\\right]\\\\\n", + " & = & \\mathbb{P}\\left[T \\gt \\delta t\\right]\\\\\n", " & = & \\left(1 - \\mathbb{P}\\left[I \\parallel T = 0 \\right]\\right)^\\kappa\n", "\\end{array}\n", "$$\n", @@ -356,7 +350,7 @@ "To estimate the probability of encountering an infected person $\\mathbb{P}\\left[I \\parallel T = 0 \\right]$ we weight integral of each state density function with the dominant term from the age-age scattering cross section, essentially counting the fractional contributions by age, and noting that any multiplicative constants cancel out:\n", "\n", "$$\n", - "\\operatorname{\\mathbb{P}}\\left[I \\parallel T = 0 \\right] = \\frac{\\int_0^\\infty n_\\text{I} \\hat{\\sigma} da}{\\int_0^\\infty \\left(n_\\text{S} + n_\\text{I} + n_\\text{R} + n_\\text{D}\\right)\\hat{\\sigma} da}\n", + "\\mathbb{P}\\left[I \\parallel T = 0 \\right] = \\frac{\\int_0^\\infty n_\\text{I} \\hat{\\sigma} da}{\\int_0^\\infty \\left(n_\\text{S} + n_\\text{I} + n_\\text{R} + n_\\text{D}\\right)\\hat{\\sigma} da}\n", "$$\n", "\n", "We introduce the inverse probability weight:\n",