| epiworld-data {epiworldR} | R Documentation |
Accessing the database of epiworld
Description
Models in epiworld are stored in a database. This database can be accessed
using the functions described in this manual page. Some elements of the
database are: the transition matrix, the incidence matrix, the reproductive
number, the generation time, and daily incidence at the virus and tool level.
Usage
get_hist_total(x)
get_today_total(x)
get_hist_virus(x)
get_hist_tool(x)
get_transition_probability(x)
get_reproductive_number(x)
## S3 method for class 'epiworld_repnum'
plot(
x,
y = NULL,
ylab = "Average Rep. Number",
xlab = "Day (step)",
main = "Reproductive Number",
type = "b",
plot = TRUE,
...
)
plot_reproductive_number(x, ...)
get_hist_transition_matrix(x, skip_zeros = FALSE)
## S3 method for class 'epiworld_hist_transition'
as.array(x, ...)
plot_incidence(x, ...)
## S3 method for class 'epiworld_hist_transition'
plot(
x,
type = "b",
xlab = "Day (step)",
ylab = "Counts",
main = "Daily incidence",
plot = TRUE,
...
)
get_transmissions(x)
get_generation_time(x)
## S3 method for class 'epiworld_generation_time'
plot(
x,
type = "b",
xlab = "Day (step)",
ylab = "Avg. Generation Time",
main = "Generation Time",
plot = TRUE,
...
)
plot_generation_time(x, ...)
Arguments
x |
An object of class |
y |
Ignored. |
ylab, xlab, main, type |
Further parameters passed to |
plot |
Logical scalar. If |
... |
In the case of plot methods, further arguments passed to graphics::plot. |
skip_zeros |
Logical scalar. When |
Details
The plot_reproductive_number function is a wrapper around
get_reproductive_number that plots the result.
The plot_incidence function is a wrapper between
get_hist_transition_matrix and it's plot method.
The plot method for the epiworld_hist_transition class plots the
daily incidence of each state. The function returns the data frame used for
plotting.
Value
The
get_hist_totalfunction returns an object of class epiworld_hist_total.
The
get_today_totalfunction returns a named vector with the total number of individuals in each state at the end of the simulation.
The
get_hist_virusfunction returns an object of class epiworld_hist_virus.
The
get_hist_toolfunction returns an object of epiworld_hist_virus.
The
get_transition_probabilityfunction returns an object of classmatrix.
The
get_reproductive_numberfunction returns an object of class epiworld_repnum.
The
plotfunction returns a plot of the reproductive number over time.
-
get_hist_transition_matrixreturns a data.frame with four columns: "state_from", "state_to", "date", and "counts."
The
as.arraymethod forepiworld_hist_transitionobjects turns thedata.framereturned byget_hist_transition_matrixinto an array ofnstates x nstates x (ndays + 1)entries, where the first entry is the initial state.
The
plot_incidencefunction returns a plot originating from the objectget_hist_transition_matrix.
The
plotfunction returns a plot which originates from theepiworld_hist_transitionobject.
The function
get_transmissionsreturns adata.framewith the following columns:date,source,target,virus_id,virus, andsource_exposure_date.
The function
get_generation_timereturns adata.framewith the following columns: "agent", "virus_id", "virus", "date", and "gentime".
The function
plot_generation_timeis a wrapper for plot and get_generation_time.
See Also
Other Models:
ModelDiffNet(),
ModelSEIR(),
ModelSEIRCONN(),
ModelSEIRD(),
ModelSEIRDCONN(),
ModelSIR(),
ModelSIRCONN(),
ModelSIRD(),
ModelSIRDCONN(),
ModelSIRLogit(),
ModelSIS(),
ModelSISD(),
ModelSURV()
Examples
# SEIR Connected
seirconn <- ModelSEIRCONN(
name = "Disease",
n = 10000,
prevalence = 0.1,
contact_rate = 2.0,
transmission_rate = 0.8,
incubation_days = 7.0,
recovery_rate = 0.3
)
# Running the simulation for 50 steps (days)
set.seed(937)
run(seirconn, 50)
# Retrieving the transition probability
get_transition_probability(seirconn)
# Retrieving date, state, and counts dataframe including any added tools
get_hist_tool(seirconn)
# Retrieving overall date, state, and counts dataframe
head(get_hist_total(seirconn))
# Retrieving date, state, and counts dataframe by variant
head(get_hist_virus(seirconn))
# Retrieving (and plotting) the reproductive number
rp <- get_reproductive_number(seirconn)
plot(rp) # Also equivalent to plot_reproductive_number(seirconn)
# We can go further and get all the history
t_hist <- get_hist_transition_matrix(seirconn)
head(t_hist)
# And turn it into an array
as.array(t_hist)[,,1:3]
# We cam also get (and plot) the incidence, as well as
# the generation time
inci <- plot_incidence(seirconn)
gent <- plot_generation_time(seirconn)