u0: Get the initial compartment state

u0R Documentation

Get the initial compartment state

Description

Get the initial compartment state

Usage

u0(object, ...)

## S4 method for signature 'SimInf_model'
u0(object, ...)

## S4 method for signature 'SimInf_indiv_events'
u0(object, time = NULL, target = NULL, age = NULL)

Arguments

object

The object to get the initial compartment state u0 from.

...

Additional arguments.

time

Only used when object is of class SimInf_indiv_events object. The time-point that will be used to create u0. If left empty (the default), the earliest time among the events will be used.

target

Only used when object is of class SimInf_indiv_events object. The SimInf model ('SEIR', 'SIR', 'SIS', 'SISe3', 'SISe3_sp', 'SISe', or 'SISe_sp') to target the events and u0 for. The default, NULL, creates an u0, but where the compartments might have to be renamed and post-processed to fit the specific use case.

age

Only used when object is of class SimInf_indiv_events object. An integer vector with break points in days for the ageing events. The default, NULL, creates an u0 where all individuals belong to the same age category.

Value

a data.frame with the initial compartment state.

Examples

## Create an SIR model object.
model <- SIR(u0 = data.frame(S = 99, I = 1, R = 0),
             tspan = 1:100,
             beta = 0.16,
             gamma = 0.077)

## Get the initial compartment state.
u0(model)

stewid/SimInf documentation built on April 26, 2024, 5:14 a.m.