Learn R Programming

SimInf (version 5.0.0)

SimInf_events: Create a "'>SimInf_events" object

Description

The argument events must be a data.frame with the following columns:

event

Type of event: 0) exit, 1) enter, 2) internal transfer, and 3) external transfer. Other values are reserved for future event types and not supported by the current default core solver.

time

Time for the event. Can be either an integer or a Date vector. A Date vector is coerced to a numeric vector as days, where t0 determines the offset to match the time of the events to the model tspan vector.

node

The node that the event operates on. Also the source node for an external transfer event. 1 <= node[i] <= Number of nodes.

dest

The destination node for an external transfer event. Should be 0 for the other event types. dest[i] >= 0.

n

The number of individuals affected by the event. n[i] >= 0.

proportion

If n[i] equals zero, the number of individuals affected by event[i] is calculated by summing the number of individuls with proportion[i]. 0 <= proportion[i] <= 1.

select

The column j in the event matrix E that determines the compartments that the event operates on.

shift

The column k in the shift matrix N that determines how individuals in internal transfer and external transfer events are shifted to enter another compartment. Should be 0 for the other event types.

Usage

SimInf_events(E = NULL, N = NULL, events = NULL, t0 = NULL)

Arguments

E

Sparse matrix of object class "'>dgCMatrix" that selects the states to include for sampling in an event.

N

Sparse matrix of object class "'>dgCMatrix" that determines how to shift the states in an INTERNAL_TRANSFER_EVENT.

events

A data.frame with events.

t0

If events$time is a Date vector, then t0 determines the offset to match the time of the events to the model tspan vector, see details. If events$time is a numeric vector, then t0 must be NULL.

Value

S4 class SimInf_events