twinstim_iafplot {surveillance} | R Documentation |
Plot the Spatial or Temporal Interaction Function of a twimstim
Description
The function plots the fitted temporal or (isotropic) spatial
interaction function of a twinstim
object.
The implementation is illustrated in Meyer et al. (2017, Section 3),
see vignette("twinstim")
.
Usage
iafplot(object, which = c("siaf", "tiaf"), types = NULL,
scaled = c("intercept", "standardized", "no"), truncated = FALSE,
log = "", conf.type = if (length(pars) > 1) "MC" else "parbounds",
conf.level = 0.95, conf.B = 999, xgrid = 101,
col.estimate = rainbow(length(types)), col.conf = col.estimate,
alpha.B = 0.15, lwd = c(3,1), lty = c(1,2),
verticals = FALSE, do.points = FALSE,
add = FALSE, xlim = NULL, ylim = NULL, xlab = NULL, ylab = NULL,
legend = !add && (length(types) > 1), ...)
Arguments
object |
object of class |
which |
argument indicating which of the two interaction functions to plot.
Possible values are |
types |
integer vector indicating for which event |
scaled |
character string determining if/how the the interaction function should be scaled. Possible choices are:
The first one is the default and required for the comparison of
estimated interaction functions from different models.
For backward compatibility, |
truncated |
logical indicating if the plotted interaction function should
take the maximum range of interaction ( |
log |
a character string passed to |
conf.type |
type of confidence interval to produce. |
conf.level |
the confidence level required. For |
conf.B |
number of samples for the |
xgrid |
either a numeric vector of x-values (distances from the host) where
to evaluate |
col.estimate |
vector of colours to use for the function point estimates of the different |
col.conf |
vector of colours to use for the confidence intervals of the different |
alpha.B |
alpha transparency value (as relative opacity) used for the |
lwd , lty |
numeric vectors of length two specifying the line width and type of point estimates (first element) and confidence limits (second element), respectively. |
verticals , do.points |
graphical settings for step function
kernels. These can be logical (as in |
add |
add to an existing plot? |
xlim , ylim |
vectors of length two containing the x- and y-axis limit of the
plot. The default y-axis range (
|
xlab , ylab |
labels for the axes with |
legend |
logical indicating if a legend for the |
... |
additional arguments passed to the default |
Value
A plot is created – see e.g. Figure 3(b) in Meyer et al. (2012).
The function invisibly returns a matrix of the plotted values of the
interaction function (evaluated on xgrid
, by type). The first
column of the matrix contains the distance x
, and the remaining
length(types)
columns contain the (scaled) function values for
each type.
The pointwise confidence intervals of the interaction functions are
returned in similar matrices as attributes: if
length(types)==1
, there is a single attribute "CI"
,
whereas for multiple types, the attributes are named
paste0("CI.",typeNames)
(where the typeNames
are
retrieved from object$qmatrix
).
Author(s)
Sebastian Meyer
References
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., 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
plot.twinstim
, which calls this function.
Examples
data("imdepifit")
iafplot(imdepifit, "tiaf", scaled=FALSE) # tiaf.constant(), not very exciting
iafplot(imdepifit, "siaf", scaled=FALSE)
# scaled version uses a Monte-Carlo-CI
set.seed(1) # result depends on .Random.seed
iafplot(imdepifit, "siaf", scaled=TRUE, conf.type="MC", conf.B=199,
col.conf=gray(0.4), conf.level=NA) # show MC samples