v0-set: Update the initial continuous state v0 in each node

v0<-R Documentation

Update the initial continuous state v0 in each node

Description

Update the initial continuous state v0 in each node

Usage

v0(model) <- value

## S4 replacement method for signature 'SimInf_model'
v0(model) <- value

Arguments

model

The model to update the initial continuous state v0.

value

A data.frame with the initial continuosu state in each node. Each row is one node, and the number of rows in v0 must match the number of nodes in model. Only the columns in v0 with a name that matches a continuous state in v0 in the model will be used.

Examples

## Create an 'SISe' model with no infected individuals and no
## infectious pressure (phi = 0, epsilon = 0).
model <- SISe(u0 = data.frame(S = 100, I = 0), tspan = 1:100,
              phi = 0, upsilon = 0.02, gamma = 0.1, alpha = 1,
              epsilon = 0, beta_t1 = 0.15, beta_t2 = 0.15,
              beta_t3 = 0.15, beta_t4 = 0.15, end_t1 = 91,
              end_t2 = 182, end_t3 = 273, end_t4 = 365)

## Run the 'SISe' model and plot the result.
set.seed(22)
result <- run(model)
plot(result)

## Update the infectious pressure 'phi' in 'v0' and run
## the model again.
v0(model) <- data.frame(phi = 1)
result <- run(model)
plot(result)

SimInf documentation built on Jan. 23, 2023, 5:43 p.m.