as.epidat {EpiILMCT} | R Documentation |
Continuous Time level information of an Epidemic
Description
The function as.epidat
is used to generate objects of class "datagen"
. These objects contain the individual event history of an epidemic along with other individual level information. The output of this function provides information required to fit continuous time individual level models.
Usage
as.epidat(type, kerneltype, incub.time = NULL, inf.time, rem.time,
id.individual, location = NULL, network = NULL, network.type = NULL)
Arguments
type |
type of compartmental framework, with the choice of “SIR” for Susceptible-Infectious-Removed and “SINR” for Susceptible-Infectious-Notified-Removed. |
kerneltype |
type of kernel function with choice of “distance” for a distance-based ILM, “network” for a contact network-based ILM and “both” for a combination of network- and distance-based ILM. |
incub.time |
a vector of the incubation times of individuals. It is required when |
inf.time |
a vector of the infection times of individuals. |
rem.time |
a vector of the removal times of individuals. |
id.individual |
a vector of the id number of individuals. |
location |
a matrix of the XY coordinates of individuals. It is required when |
network |
a contact network matrix. It is required when |
network.type |
type of the contact network model, see the argument |
Details
The id.individual
is used here to relate individuals to their corresponding row numbers of the location
, and contact network
, matrices. The elements of the incub.time
, inf.time
, and rem.time
vectors must be in sync with those elements of the id.individual
vector. Then, each individual will have an id number and corresponding event times. Any mistake in entering these vectors can seriously affect the use of other functions like epictmcmc
and plot.datagen
which can highly lead to incorrect results and conclusion.
Value
A class of “datagen” which has a list of type
, kerneltype
, a sorted matrix of the epidemic with respect to the infection times in ascending order, the XY coordinates of individuals, and/or the contact network.
See Also
epictmcmc
, datagen
, plot.datagen
.
Examples
# Just for illustation:
# SIR distance-based ILM for a population of 10 individuals:
loc <- cbind(runif(10, 0, 10), runif(10,0,10))
net <- contactnet(type = "random", num.id = 10, location = loc, beta = 0.3)
infection <- c(2.5, 1, 0, 0, 0.5, 0, 2, 1.5, 0, 3)
removal <- c(3.5, 2, 0, 1, 1.5, 0, 3, 2.5, 0, 4)
id <- c(2, 1, 4, 7, 10, 3, 5, 9, 8, 6)
epi <- as.epidat(type = "SIR", kerneltype = "distance", inf.time = infection,
rem.time = removal, id.individual = id, location = loc)
epi
# using the data set generated by using the SINR network-based ILM:
data(NetworkDataSINR)
names(NetworkDataSINR)
netSINR<-as.epidat(type = "SINR", kerneltype = "network",
incub.time = NetworkDataSINR$epi[,4], inf.time = NetworkDataSINR$epi[,6],
rem.time = NetworkDataSINR$epi[,2], id.individual = NetworkDataSINR$epi[,1],
location = NetworkDataSINR$loc, network = NetworkDataSINR$net,
network.type = "powerlaw")
names(netSINR)
plot(netSINR, plottype = "history")
netSIR<-as.epidat(type = "SIR", kerneltype = "network",
inf.time = NetworkDataSINR$epi[,6], rem.time = NetworkDataSINR$epi[,2],
id.individual = NetworkDataSINR$epi[,1], location = NetworkDataSINR$loc,
network = NetworkDataSINR$net, network.type = "powerlaw")
names(netSIR)
plot(netSIR, plottype = "history")