Learn R Programming

surveillance (version 1.8-0)

hhh4_W: Power-Law and Nonparametric Neighbourhood Weights for hhh4-Models

Description

Set up power-law or nonparametric weights for the neighbourhood component of hhh4-models as proposed by Meyer and Held (2014). Without normalization, power-law weights are $w_{ji} = o_{ji}^{-d}$, where $o_{ji}$ is the order of neighbourhood between regions $i$ and $j$, see nbOrder.

Usage

W_powerlaw(maxlag, normalize = TRUE,
           log = FALSE, initial = if (log) 0 else 1)

W_np(maxlag, to0 = FALSE, normalize = TRUE, initial = log(zetaweights(2:maxlag)))

Arguments

maxlag,to0
a single integer specifying a limiting order of neighbourhood. For W_powerlaw, weights are positive up to maxlag and set to 0 for higher orders. If spatial dependence is not to be truncated at some high order, m
normalize
logical indicating if the weights should be normalized such that the rows of the weight matrix sum to 1 (default).
log
logical indicating if the decay parameter $d$ should be estimated on the log-scale to ensure positivity.
initial
initial value of the parameter vector.

Value

  • a list which can be passed as a specification of parametric neighbourhood weights in the control$ne$weights argument of hhh4.

References

Meyer, S. and Held, L. (2014): Power-law models for infectious disease spread. Annals of Applied Statistics. In press. arXiv:1308.5115 arXiv-Link: http://arxiv.org/abs/1308.5115

See Also

nbOrder to determine the matrix of neighbourhood orders from a binary adjacency matrix. siaf.powerlaw, and siaf.step for modelling distance decay as power law or step function in twinstim space-time point process models.

Examples

Run this code
if (requireNamespace("spdep")) {
  data("measles.weser")
  measles <- disProg2sts(measles.weser)

  ## parametric powerlaw weights require neighbourhood orders in the data
  neighbourhood(measles) <- nbOrder(neighbourhood(measles), maxlag=Inf)

  ## a simple hhh4 model with power-law decay of spatial interaction
  m <- list(ar = list(f = ~ 1),
            ne = list(f = ~ 1, weights = W_powerlaw(maxlag=4, log=FALSE)),
            end = list(f = addSeason2formula(~-1 + ri(), S=1, period=52),
                       offset = population(measles)),
            family = "NegBin1", verbose=TRUE)

  ## fit the model
  set.seed(1)  # random intercepts are initialized randomly
  fit <- hhh4(measles, m)
  summary(fit)  # "neweights.d" is the decay parameter
}

Run the code above in your browser using DataLab