'>SimInf_events
objectThe argument events must be a data.frame
with the following
columns:
Four event types are supported by the current solvers:
exit, enter, internal transfer, and
external transfer. When assigning the events, they can
either be coded as a numerical value or a character string:
exit; 0
or 'exit'
, enter; 1
or 'enter'
, internal transfer; 2
or
'intTrans'
, and external transfer; 3
or
'extTrans'
. Internally in SimInf, the event type
is coded as a numerical value.
When the event occurs i.e., the event is processed when time
is reached in the simulation. 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.
The node that the event operates on. Also the source node for
an external transfer event.
1 <= node[i]
<= Number of nodes.
The destination node for an external transfer event
i.e., individuals are moved from node
to dest
,
where 1 <= dest[i]
<= Number of nodes. Set event
= 0
for the other event types. dest
is an integer
vector.
The number of individuals affected by the event. n[i] >= 0.
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.
To process event[i]
, the compartments affected by the
event are specified with select[i]
together with the
matrix E
, where select[i]
determines which
column in E
to use. The specific individuals affected
by the event are proportionally sampled from the compartments
corresponding to the non-zero entries in the specified column
in E[, select[i]]
, where select
is an integer
vector.
Determines how individuals in internal transfer and
external transfer events are shifted to enter another
compartment. The sampled individuals are shifted according to
column shift[i]
in matrix N
i.e., N[,
shift[i]]
, where shift
is an integer vector. See
above for a description of N
. Unsued for the other
event types.
SimInf_events(E = NULL, N = NULL, events = NULL, t0 = NULL)
Each row corresponds to one compartment in the model. The
non-zero entries in a column indicates the compartments to
include in an event. For the exit, internal
transfer and external transfer events, a non-zero
entry indicate the compartments to sample individuals from.
For the enter event, all individuals enter first
non-zero compartment. E
is sparse matrix of class
'>dgCMatrix
.
Determines how individuals in internal transfer
and external transfer events are shifted to enter
another compartment. Each row corresponds to one compartment
in the model. The values in a column are added to the current
compartment of sampled individuals to specify the destination
compartment, for example, a value of 1
in an entry
means that sampled individuals in this compartment are moved
to the next compartment. Which column to use for each event
is specified by the shift
vector (see below). N
is an integer matrix.
A data.frame
with events.
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
.
S4 class SimInf_events