Learn R Programming

surveillance (version 1.5-4)

twinSIR_epidata_intersperse: Impute Blocks for Extra Stops in "epidata" Objects

Description

This function modifies an object inheriting from class "epidata" such that it features the specified stop time points. For this purpose, the time interval in the event history into which the new stop falls will be splitted up into two parts, one block for the time period until the new stop -- where no infection or removal occurs -- and the other block for the time period from the new stop to the end of the original interval. Main application is to enable the use of knots in twinSIR, which are not existing stop time points in the "epidata" object.

Usage

intersperse(epidata, stoptimes)

Arguments

epidata
an object inheriting from class "epidata".
stoptimes
a numeric vector of time points inside the observation period of the epidata.

Value

  • an object of the same class as epidata with additional time blocks for any new stoptimes.

Examples

Run this code
data("fooepidata")
subset(fooepidata, start < 25 & stop > 25, select = 1:7)
nrow(fooepidata)
moreStopsEpi <- intersperse(fooepidata, c(25,75))
nrow(moreStopsEpi)
subset(moreStopsEpi, stop == 25 | start == 25, select = 1:7)

Run the code above in your browser using DataLab