erlang: Utility function for mparse in SimInf

Description Usage Arguments Examples

Description

Create a model for an Erlang distribution in SimInf

Usage

1
erlang(src, dst, shape, rate)

Arguments

src

The name of the source compartment.

dst

The name of the destination compartment.

shape

The shape parameter (integer) of the Erlang distribtion.

rate

The rate parameter of the Erlang distribution.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(SimInf)
library(SWmisc)

shape <- 100
m <- erlang("A", "B", shape, rate = shape / 730)
u0 <- matrix(c(100, rep(0, length(m$compartments) - 1)),
             ncol = length(m$compartments))
u0 <- as.data.frame(u0)
colnames(u0) <- m$compartments
m <- mparse(m$transitions, m$compartments)
model <- init(m, u0, 1:1000)
plot(as.numeric(SimInf:::extract_U(run(model), "B")),
     type = "l", ylab = "Number of individuals in B compartment",
     xlab = "Time [day]")

stewid/SWmisc documentation built on May 5, 2019, 5:54 p.m.