Description Usage Arguments Value Examples
This function projects bed occupancy using admission incidence and a distribution of length of stay (los).
1 2 3 4 5 6 7 | project_beds(x, ...)
## S3 method for class 'projections'
project_beds(x, r_los, n_sim = 10, last_date = NULL, ...)
## S3 method for class 'incidence'
project_beds(x, r_los, n_sim = 10, last_date = NULL, ...)
|
x |
Either a |
... |
Additional arguments passed to other methods. |
r_los |
A |
n_sim |
The number of times duration of hospitalisation is simulated for each admission. Defaults to 10. Only relevant for low (<30) numbers of initial admissions, in which case it helps accounting for the uncertainty in LoS. |
last_date |
the last date to simulate until (defaults to the maximum
date of |
A projections
object
produced from the admission trajectories.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ## fake LoS; check \code{\link[distcrete:distcrete]{distcrete::distcrete}}
## for discretising existing distributions
r_los <- function(n) rgeom(n, prob = .3)
# Incidence input
## fake data
dates <- Sys.Date() - 1:10
admissions <- sample(1:100, 10, replace = TRUE)
x <- incidence::incidence(rep(dates, admissions))
x
plot(x)
## project bed occupancy
beds <- project_beds(x, r_los)
beds
plot(beds)
# Projections input
## make fake data - each column after the first is a separate forecast
admissions <- data.frame(
date = Sys.Date() - 1:10,
as.data.frame(replicate(30, sample(1:100, 10, replace = TRUE))))
x <- build_projections(x = admissions[, -1], dates = admissions$date)
x
plot(x)
## project bed occupancy
beds <- project_beds(x, r_los)
beds
plot(beds)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.