| twinstim_iaf {surveillance} | R Documentation |
Temporal and Spatial Interaction Functions for twinstim
Description
A twinstim model as described in Meyer et al. (2012) requires
the specification of the spatial and temporal interaction functions
(f and g, respectively),
i.e. how infectivity decays with increasing spatial and temporal
distance from the source of infection.
Own such functions can be specified (see
siaf and tiaf, respectively), but the
package already predefines some common dispersal kernels returned by
the constructor functions documented here.
See Meyer and Held (2014) for various spatial interaction functions,
and Meyer et al. (2017, Section 3, available as vignette("twinstim"))
for an illustration of the implementation.
Usage
# predefined spatial interaction functions
siaf.constant()
siaf.step(knots, maxRange = Inf, nTypes = 1, validpars = NULL)
siaf.gaussian(nTypes = 1, logsd = TRUE, density = FALSE,
F.adaptive = FALSE, F.method = "iso",
effRangeMult = 6, validpars = NULL)
siaf.exponential(nTypes = 1, validpars = NULL, engine = "C")
siaf.powerlaw(nTypes = 1, validpars = NULL, engine = "C")
siaf.powerlaw1(nTypes = 1, validpars = NULL, sigma = 1)
siaf.powerlawL(nTypes = 1, validpars = NULL, engine = "C")
siaf.student(nTypes = 1, validpars = NULL, engine = "C")
# predefined temporal interaction functions
tiaf.constant()
tiaf.step(knots, maxRange = Inf, nTypes = 1, validpars = NULL)
tiaf.exponential(nTypes = 1, validpars = NULL)
Arguments
knots |
numeric vector of distances at which the step function
switches to a new height. The length of this vector determines the
number of parameters to estimate. For identifiability, the step
function has height 1 in the first interval |
maxRange |
a scalar larger than any of |
nTypes |
determines the number of parameters ((log-)scales or (log-)shapes)
of the kernels. In a multitype epidemic, the different types may
share the same spatial interaction function, in which case
|
logsd, density |
logicals affecting the parametrization of the Gaussian kernel.
Settings different from the defaults are deprecated.
The default is to use only the kernel of the bivariate, isotropic
normal distribution ( |
F.adaptive, F.method |
If |
effRangeMult |
determines the effective range for numerical integration
in terms of multiples of the standard deviation |
validpars |
function taking one argument, the parameter vector, indicating if it
is valid (see also |
engine |
character string specifying the implementation to use.
Prior to surveillance 0.14.0, the |
sigma |
Fixed value of |
Details
Evaluation of twinstim's likelihood involves cubature of the
spatial interaction function over polygonal domains. Various
approaches have been compared by Meyer (2010, Section 3.2) and a new
efficient method, which takes advantage of the assumed isotropy, has
been proposed by Meyer and Held (2014, Supplement B, Section 2) for
evaluation of the power-law kernels.
These cubature methods are available in the dedicated R package
polyCub and used by the kernels implemented in surveillance.
The readily available spatial interaction functions are defined as follows:
siaf.constant:-
f(s) = 1 siaf.step:-
f(s) = \sum_{k=0}^K \exp(\alpha_k) I_k(||s||),
where\alpha_0 = 0, and\alpha_1, \dots, \alpha_Kare the parameters (heights) to estimate.I_k(||s||)indicates if distance||s||belongs to thekth interval according toc(0,knots,maxRange), wherek=0indicates the intervalc(0,knots[1]).
Note thatsiaf.stepmakes use of the memoise package if it is available – and that is highly recommended to speed up calculations. Specifically, the areas of the intersection of a polygonal domain (influence region) with the “rings” of the two-dimensional step function will be cached such that they are only calculated once for everypolydomain(in the first iteration of thetwinstimoptimization). They are used in the integration componentsFandDeriv. See Meyer and Held (2014) for a use case and further details. siaf.gaussian:-
f(s|\kappa) = \exp(-||s||/2/\sigma_\kappa^2)
IfnTypes=1(single-type epidemic or type-invariantsiafin multi-type epidemic), then\sigma_\kappa = \sigmafor all types\kappa. Ifdensity=TRUE(deprecated), then the kernel formula above is additionally divided by2 \pi \sigma_\kappa^2, yielding the density of the bivariate, isotropic Gaussian distribution with zero mean and covariance matrix\sigma_\kappa^2 I_2. The standard deviation is optimized on the log-scale (logsd = TRUE, not doing so is deprecated). siaf.exponential:-
f(s) = exp(-||s||/sigma)
The scale parametersigmais estimated on the log-scale, i.e.,\sigma = \exp(\tilde{\sigma}), and\tilde{\sigma}is the actual model parameter. siaf.powerlaw:-
f(s) = (||s|| + \sigma)^{-d}
The parameters are optimized on the log-scale to ensure positivity, i.e.,\sigma = \exp(\tilde{\sigma})andd = \exp(\tilde{d}), where(\tilde{\sigma}, \tilde{d})is the parameter vector. If a power-law kernel is not identifiable for the dataset at hand, the exponential kernel or a lagged power law are useful alternatives. siaf.powerlaw1:-
f(s) = (||s|| + 1)^{-d},
i.e.,siaf.powerlawwith fixed\sigma = 1. A different fixed value forsigmacan be specified via thesigmaargument ofsiaf.powerlaw1. The decay parameterdis estimated on the log-scale. siaf.powerlawL:-
f(s) = (||s||/\sigma)^{-d}, for||s|| \ge \sigma, andf(s) = 1otherwise,
which is a Lagged power-law kernel featuring uniform short-range dispersal (up to distance\sigma) and a power-law decay (Pareto-style) from distance\sigmaonwards. The parameters are optimized on the log-scale to ensure positivity, i.e.\sigma = \exp(\tilde{\sigma})andd = \exp(\tilde{d}), where(\tilde{\sigma}, \tilde{d})is the parameter vector. However, there is a caveat associated with this kernel: Its derivative wrt\tilde{\sigma}is mathematically undefined at the threshold||s||=\sigma. This local non-differentiability makestwinstim's likelihood maximization sensitive wrt parameter start values, and is likely to cause false convergence warnings bynlminb. Possible workarounds are to use the slow and robustmethod="Nelder-Mead", or to just ignore the warning and verify the result by sets of different start values. siaf.student:-
f(s) = (||s||^2 + \sigma^2)^{-d},
which is a reparametrizedt-kernel. Ford=1, this is the kernel of the Cauchy density with scalesigma. In Geostatistics, a correlation function of this kind is known as the Cauchy model.
The parameters are optimized on the log-scale to ensure positivity, i.e.\sigma = \exp(\tilde{\sigma})andd = \exp(\tilde{d}), where(\tilde{\sigma}, \tilde{d})is the parameter vector.
The predefined temporal interaction functions are defined as follows:
tiaf.constant:-
g(t) = 1 tiaf.step:-
g(t) = \sum_{k=0}^K \exp(\alpha_k) I_k(t),
where\alpha_0 = 0, and\alpha_1, \dots, \alpha_Kare the parameters (heights) to estimate.I_k(t)indicates iftbelongs to thekth interval according toc(0,knots,maxRange), wherek=0indicates the intervalc(0,knots[1]). tiaf.exponential:-
g(t|\kappa) = \exp(-\alpha_\kappa t),
which is the kernel of the exponential distribution. IfnTypes=1(single-type epidemic or type-invarianttiafin multi-type epidemic), then\alpha_\kappa = \alphafor all types\kappa.
Value
The specification of an interaction function, which is a list.
See siaf and tiaf, respectively, for a
description of its components.
Author(s)
Sebastian Meyer
References
Meyer, S. (2010):
Spatio-Temporal Infectious Disease Epidemiology based on Point Processes.
Master's Thesis, Ludwig-Maximilians-Universität
München.
Available as https://epub.ub.uni-muenchen.de/11703/
Meyer, S., Elias, J. and Höhle, M. (2012): A space-time conditional intensity model for invasive meningococcal disease occurrence. Biometrics, 68, 607-616. doi:10.1111/j.1541-0420.2011.01684.x
Meyer, S. and Held, L. (2014): Power-law models for infectious disease spread. The Annals of Applied Statistics, 8 (3), 1612-1639. doi:10.1214/14-AOAS743
Meyer, S., Held, L. and Höhle, M. (2017): Spatio-temporal analysis of epidemic phenomena using the R package surveillance. Journal of Statistical Software, 77 (11), 1-55. doi:10.18637/jss.v077.i11
See Also
twinstim, siaf, tiaf,
and package polyCub for the involved cubature methods.
Examples
# constant temporal dispersal
tiaf.constant()
# step function kernel
tiaf.step(c(3,7), maxRange=14, nTypes=2)
# exponential temporal decay
tiaf.exponential()
# Type-dependent Gaussian spatial interaction function using an adaptive
# two-dimensional midpoint-rule to integrate it over polygonal domains
siaf.gaussian(2, F.adaptive=TRUE)
# Single-type Gaussian spatial interaction function (using polyCub.iso)
siaf.gaussian()
# Exponential kernel
siaf.exponential()
# Power-law kernel
siaf.powerlaw()
# Power-law kernel with fixed sigma = 1
siaf.powerlaw1()
# "lagged" power-law
siaf.powerlawL()
# (reparametrized) t-kernel
siaf.student()
# step function kernel
siaf.step(c(10,20,50), maxRange=100)