mk_event_poisson {IBMPopSim} | R Documentation |
Creating Poisson class event
Description
The function mk_event_poisson
is used to create an event with intensity of type Poisson (constant intensity which does not depend on population or time).
When the event occurs, something happens in the population.
The created event must be used with mk_model
.
Usage
mk_event_poisson(type, name, intensity, kernel_code = "")
Arguments
type |
Must be one of |
name |
(Optional) If not specified, the name given to the event is its type. |
intensity |
String containing some constant positive value, or name of a parameter which is a constant positive value. |
kernel_code |
String containing some C++ code describing the event action. Optional for |
Details
The type
argument is one of the following
'birth'
By default, a new individual
newI
is created, with the same characteristics of the parentI
and birth date equal to the current time. Optional code can be precised inkernel_code
.'death'
By default, the individual
I
dies. Optional code can be precised inkernel_code
.'entry'
A new individual
newI
is added to the population, and its characteristics have to be defined by the user in the entrykernel_code
.'exit'
An individual
I
exits from the population. Optional code can be precised inkernel_code
.'swap'
The user can change the characteristics of the selected individual
I
. This requireskernel_code
.'custom'
None of the above types, the user defines
kernel_code
that can act on the selected individualI
and on the populationpop
.
The kernel_code
argument is a string containing some C++ code which describing the action of the event. Some of available variables in the C++ code are: t
(the current time), pop
(the current population), I
(the current individual selected for the event), newI
(the new individual if 'birth'
or 'entry'
event), the name of the model parameters (some variables, or functions, see mk_model
).
See vignette('IBMPopSim')
for more details.
Value
An S3 object of class event
of type Poisson.
See Also
mk_model
, mk_event_inhomogeneous_poisson
, mk_event_individual
, mk_event_interaction
.
Examples
birth <- mk_event_poisson('birth', intensity = 10)
params <- list(beta = 10)
death <- mk_event_poisson('death', intensity = 'beta') # name of one parameter
mk_model(events = list(birth, death), parameters = params)