Learn R Programming

surveillance (version 1.5-4)

twinstim_iafplot: 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.

Usage

iafplot(object, which = c("siaf", "tiaf"),
    types = 1:nrow(object$qmatrix), scaled = FALSE,
    conf.type = if (length(pars) > 1) "bootstrap" 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), xlim = NULL, ylim = NULL,
    add = FALSE, xlab = NULL, ylab = NULL, ...)

Arguments

object
object of class "twinstim" containing the fitted model.
which
argument indicating which of the two interaction functions to plot. Possible values are "siaf" (default) for the spatial interaction function and "tiaf" for the temporal interaction function.
types
integer vector indicating for which event types the interaction function should be plotted in case of a marked twinstim.
scaled
logical indicating if the interaction function should be multiplied by the epidemic intercept $exp(\gamma_0)$. This is required for the comparison of estimated interaction functions from different models.
conf.type
type of confidence interval to produce. If "bootstrap", conf.B parameter values (vectors) are sampled from the asymptotic (multivariate) normal distribution of the ML estimate(s) of the interaction function parameters
conf.level
the confidence level required. For conf.type = "bootstrap" it may also be specified as NA, in which case all conf.B bootstrapped functions will be plotted with transparency value given by alpha.B
conf.B
number of samples for the "bootstrap" confidence interval.
xgrid
either a numeric vector of x-values (distances from the host) where to evaluate which, or a scalar representing the desired number of evaluation points in the interval c(0,xlim[2]).
col.estimate
vector of colours to use for the function point estimates of the different types.
col.conf
vector of colours to use for the confidence intervals of the different types.
alpha.B
alpha transparency value (as relative opacity) used for the conf.B bootstrapped interaction functions in case conf.level = NA
lwd, lty
numeric vectors of length two specifying the line width and type of point estimates (first element) and confidence limits (second element), respectively.
xlim, ylim
vectors of length two containing the x- and y-axis limit of the plot. The default y-axis ranges from 0 to 1 (or to $exp(\gamma_0)$, if scaled). The default x-axis ranges from 0 to the length of the observation period (wh
add
add to an existing plot?
xlab, ylab
labels for the axes with NULL providing sensible defaults.
...
additional arguments passed to the default plot method.

Value

  • A plot is created -- see e.g. Figure 3(b) in Meyer et al. (2012). NULL is returned (invisibly).

encoding

latin1

References

Meyer, S., Elias, J. and H{oe}hle, M. (2012): A space-time conditional intensity model for invasive meningococcal disease occurrence. Biometrics, 68, 607-616. DOI-Link: http://dx.doi.org/10.1111/j.1541-0420.2011.01684.x

See Also

plot.twinstim, which calls this function.

Examples

Run this code
data(imdepifit)
iafplot(imdepifit, "tiaf", types=1)   # tiaf.constant(), not very exciting
iafplot(imdepifit, "siaf", types=1,   # same for types=2
        xlim=c(0,200), col.estimate=1, lwd=c(2,1))

# bootstrap-CI (used if more than one parameter is affected)
iafplot(imdepifit, "siaf", types=1, scaled=TRUE, xlim=c(0,200), xgrid=500,
        conf.type="bootstrap", col.estimate=2)

Run the code above in your browser using DataLab