Skip to contents

Calculates maximum LOS from mean and SD of LOS distribution. If LOS is lnorm, sample from rlnorm distribution until you get a value that is >=0 and <= the max LOS. Uses do.call() as we need to input mean and SD for rlnorm() from a list

Usage

dis_los(
  z = parent.frame()$z,
  los_dist = parent.frame()$srv_dist_visit[[z]],
  los_lnorm_mean_sd = parent.frame()$srv_params_visit[[z]],
  los_norm_mean = parent.frame()$mean_los_visit[[z]],
  los_norm_sd = parent.frame()$sd_los_visit[[z]]
)

Arguments

z

Integer - refers to the current scenario and location as the simulation loops through pathway_vector_visit, e.g. 4

los_dist

String - the distribution type, e.g. "lnorm" - default is from srv_dist_visit

los_lnorm_mean_sd

Float vector - the mean and SD for the lnorm distribution, e.g. c(1.52 1.32) - default is from srv_params_visit

los_norm_mean

Float - the mean for the other distribution type, e.g. 10.23 - default is from mean_los_visit

los_norm_sd

Float - the SD for the other distribution type, e.g. 3 - default is from sd_los_visit

Value

as.integer(x) - the length of stay as an integer

Examples

dis_los(z = 1,
        los_dist = "lnorm",
        los_lnorm_mean_sd = c(2.197225, 1.180702),
        los_norm_mean = 18.07,
        los_norm_sd = 3)
#> [1] 7