hhh4contacts (version 0.13.1)

noroBE: Create "sts" Objects from the Berlin Norovirus Data

Description

The function noroBE() creates an "sts" object based on the array of norovirus surveillance counts, the map of Berlin's city district, and the pop2011 data stored in the package. This is the data analysed by Meyer and Held (2017).

Usage

noroBE(
  by = c("districts", "agegroups", "all", "none"),
  agegroups = c(1, 2, 2, 4, 4, 2),
  timeRange = c("2011-w27", "2015-w26"),
  flatten = FALSE
)

counts

map

Format

counts:

an integer-valued array of norovirus surveillance counts with labelled dimensions of size 290 ("week") x 12 ("district") x 15 ("agegroup").

map:

a "SpatialPolygonsDataFrame" of length 12 with row.names(map) matching colnames(counts), representing Berlin's city districts in longlat coordinates (WGS84). The data slot contains the full "NAME"s of the city districts as well as their "POPULATION", i.e., rowSums(pop2011).

The function noroBE() returns an "sts" object generated from these data (and pop2011).

Arguments

by

character string determining the stratification, i.e., which units the resulting "sts" object should represent:

"districts":

aggregates counts and pop2011 over the age groups and stores the matrix of adjacency orders from the map in the neighbourhood slot. The latter is obtained via nbOrder(poly2adjmat(map), maxlag = 5).

"agegroups":

aggregates counts and pop2011 over the districts and stores the contactmatrix() in the neighbourhood slot, potentially also combining some age groups via the agegroups argument.

"all":

retains both dimensions, either as a list of spatial "sts" objects per age group, or in a single "sts" object (see flatten below).

"none":

creates the overall (univariate) time series of rowSums(counts).

agegroups

how the age groups in counts (and pop2011) should be aggregated. Will be used as the grouping argument in aggregateCountsArray and contactmatrix. The default setting uses the six age groups of Meyer and Held (2017).

timeRange

character vector of length two determining the time range of the "sts" object to generate. The two strings are matched against dimnames(counts)[[1]], which ranges from "2011-w01" until "2016-w30". The default value extracts four seasons (years) starting at "2011-w27".

flatten

logical indicating whether for by = "all" a single "sts" object should be returned where the observation unit is the interaction of district and age group (“flattened” counts array, see as.data.frame.array). By default (flatten = FALSE), a list of district-based "sts" objects is returned, one for each age group.

Author

Sebastian Meyer

References

Meyer S and Held L (2017): Incorporating social contact data in spatio-temporal models for infectious disease spread. Biostatistics, 18 (2), 338-351. tools:::Rd_expr_doi("10.1093/biostatistics/kxw051")

Examples

Run this code
## the raw data
str(counts)
summary(map)

## district-specific time series
noroBEr <- noroBE(by = "districts")
plot(noroBEr)

## age group-specific time series
noroBEg <- noroBE(by = "agegroups")
plot(noroBEg)

## list of spatio-temporal surveillance counts, one for each age group
noroBErbyg <- noroBE(by = "all", flatten = FALSE)
plot(noroBErbyg[[1L]], par.list = list(oma=c(0,0,2,0)))
title(main = names(noroBErbyg)[1], outer = TRUE, line = -1)

## flattened "sts" object (the 'neighbourhood' only reflects spatial info)
noroBEall <- noroBE(by = "all", flatten = TRUE)
dev.new(width = 16, height = 7)
plot(noroBEall, par.list = list(
    xaxt = "n", mar = c(1,4,1,1), mfrow = c(ncol(noroBEg), ncol(noroBEr))
))

Run the code above in your browser using DataLab