Learn R Programming

babsim.hospital (version 11.5.14)

babsimHospital: babsimHospital

Description

Simulate resource allocation in hospitals.

Usage

babsimHospital(arrivalTimes = NULL, conf = list(), para = list(), ...)

Arguments

arrivalTimes

Arrival times as generated using getArrivalTimes.

conf

list with the following entries:

seed

seed. Default: 123

simRepeats

simmer repeats

parallel

simmer parallel runs. Default: FALSE

perCores

percentage of cores used for parallel simmer simulations. Default: 0.5 (=50 percent)

ICU

use ICU infection data. Default: FALSE

logLevel

log leved (0 or 1). Default: 0 (no output)

para

List with parameter settings. Can be generated with babsimHospitalPara.

...

additional parameters passed to fun.

Value

This function returns an env list with:

xbest

Parameters of the best found solution (matrix).

Examples

Run this code
# NOT RUN {
require("simmer")
require("dplyr")
# Generate simulation data based on number of infected persons per day: 
x <- dataCovidBeds20200624
arrivalTimes <- getArrivalTimes(x$Infected) 
conf = babsimToolsConf()
y <- babsimHospital(arrivalTimes = arrivalTimes,
                   conf = babsimToolsConf(),
                   para = babsimHospitalPara())
resources <- get_mon_resources(y)
# resources <- resources %>% filter(resource != "nurse")
mean(resources$server)

## 2nd example (shows details):
# Generate simulation data based on number of infected persons per day: 
x <- dataCovidBeds20200624
arrivalTimes <- getArrivalTimes(x$Infected) 
para <- babsimHospitalPara()
conf <- babsimToolsConf()
conf$logLevel = 1
conf$simRepeats = 1
para$GammaShapeParameter = 0.8 
y <- babsimHospital(arrivalTimes = arrivalTimes, 
                    conf = conf, 
                    para = para)

# }

Run the code above in your browser using DataLab