twinstim
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.
It is of course possible to define own functions (see
siaf
and tiaf
, respectively), but the
package already predefines some useful dispersal kernels returned by
the constructor functions documented here.
See Meyer and Held (2014) for various spatial interaction functions,
and Meyer et al. (2016, Section 3) for an illustration of
the implementation.# 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 = TRUE, effRangeMult = 6, validpars = NULL)
siaf.powerlaw(nTypes = 1, validpars = NULL)
siaf.powerlawL(nTypes = 1, validpars = NULL)
siaf.student(nTypes = 1, validpars = NULL)# predefined temporal interaction functions
tiaf.constant()
tiaf.step(knots, maxRange = Inf, nTypes = 1, validpars = NULL)
tiaf.exponential(nTypes = 1, validpars = NULL)
knots
.
Per default (maxRange=Inf
), the step function
never drops to 0 but keeps the last height for any distance larger
than the last knot. However, this might not work in some cases,
wnTypes=1
. Otherwise nTypes
density=TRUE
, siaf.gaussian
uses the density of the
bivariate, isotropic normal distribution as the spatial interaction
function. Otherwise (defaF.adaptive = TRUE
, then an adaptive bandwidth of
adapt*sd
will be used in the midpoint-cubature
(polyCub.midpoint
in package effRangeMult=6
the $6 \sigma$ region around the event is considered as
the relsiaf
).
If logsd=FALSE
and one prefers not to use
method="L-BFGS-B"
for fitting the 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 Rpackage
Meyer, S., Elias, J. and H
Meyer, S. and Held, L. (2014):
Power-law models for infectious disease spread.
The Annals of Applied Statistics, 8 (3), 1612-1639.
DOI-Link:
Meyer, S., Held, L. and H
twinstim
, siaf
, tiaf
,
and package # constant temporal dispersal
tiaf.constant()
# step function kernel
tiaf.step(c(3,7), maxRange=14, nTypes=2)
# exponential decay specification
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)
# Type-independent power-law kernel
siaf.powerlaw()
# "lagged" power-law
siaf.powerlawL()
# (reparametrized) t-kernel
siaf.student()
# step function kernel
siaf.step(c(10,20,50), maxRange=100)
Run the code above in your browser using DataLab