|
| 1 | +#' Acute Stroke Unit (ASU) arrival intervals (days). |
| 2 | +#' |
| 3 | +#' For example, a value of 1.2 means a new admission every 1.2 days. |
| 4 | +#' |
| 5 | +#' @param stroke Numeric. Mean days between stroke patient arrivals. |
| 6 | +#' @param tia Numeric. Mean days between transient ischaemic attack (TIA) |
| 7 | +#' patient arrivals. |
| 8 | +#' @param neuro Numeric. Mean days between complex neurological patient |
| 9 | +#' arrivals. |
| 10 | +#' @param other Numeric. Mean days between other patient arrivals. |
| 11 | +#' |
| 12 | +#' @return A named list of arrival intervals for ASU. |
| 13 | +create_asu_arrivals <- function( |
| 14 | + stroke = 1.2, tia = 9.3, neuro = 3.6, other = 3.2 |
| 15 | +) { |
| 16 | + list( |
| 17 | + stroke = stroke, |
| 18 | + tia = tia, |
| 19 | + neuro = neuro, |
| 20 | + other = other |
| 21 | + ) |
| 22 | +} |
| 23 | + |
| 24 | +#' Rehabilitation unit arrival intervals (days). |
| 25 | +#' |
| 26 | +#' For example, a value of 21.8 means a new admission every 21.8 days. |
| 27 | +#' |
| 28 | +#' @param stroke Numeric. Mean days between stroke patient arrivals. |
| 29 | +#' @param neuro Numeric. Mean days between complex neurological patient |
| 30 | +#' arrivals. |
| 31 | +#' @param other Numeric. Mean days between other patient arrivals. |
| 32 | +#' |
| 33 | +#' @return A named list of arrival intervals for rehabilitation unit. |
| 34 | +create_rehab_arrivals <- function( |
| 35 | + stroke = 21.8, neuro = 31.7, other = 28.6 |
| 36 | +) { |
| 37 | + list( |
| 38 | + stroke = stroke, |
| 39 | + neuro = neuro, |
| 40 | + other = other |
| 41 | + ) |
| 42 | +} |
| 43 | + |
| 44 | +#' Acute Stroke Unit (ASU) length of stay (LOS) distributions (days). |
| 45 | +#' |
| 46 | +#' Mean and standard deviation (SD) of LOS in days in the ASU. |
| 47 | +#' |
| 48 | +#' @param stroke_noesd_mean Numeric. Mean LOS for stroke patients without early |
| 49 | +#' supported discharged (ESD). |
| 50 | +#' @param stroke_noesd_sd Numeric. SD LOS for stroke patients without ESD. |
| 51 | +#' @param stroke_esd_mean Numeric. Mean LOS for stroke patients with ESD. |
| 52 | +#' @param stroke_esd_sd Numeric. SD LOS for stroke patients with ESD. |
| 53 | +#' @param stroke_mortality_mean Numeric. Mean LOS for stroke patients who pass |
| 54 | +#' away. |
| 55 | +#' @param stroke_mortality_sd Numeric. SD LOS for stroke patients who pass |
| 56 | +#' away. |
| 57 | +#' @param tia_mean Numeric. Mean LOS for transient ischemic attack (TIA) |
| 58 | +#' patients. |
| 59 | +#' @param tia_sd Numeric. SD LOS for TIA patients. |
| 60 | +#' @param neuro_mean Numeric. Mean LOS for complex neurological patients |
| 61 | +#' @param neuro_sd Numeric. SD LOS for complex neurological patients |
| 62 | +#' @param other_mean Numeric. Mean LOS for other patients. |
| 63 | +#' @param other_sd Numeric. SD LOS for other patients. |
| 64 | +#' |
| 65 | +#' @return A named list of LOS distributions for ASU. |
| 66 | +create_asu_los <- function( |
| 67 | + stroke_noesd_mean = 7.4, stroke_noesd_sd = 8.61, |
| 68 | + stroke_esd_mean = 4.6, stroke_esd_sd = 4.8, |
| 69 | + stroke_mortality_mean = 7.0, stroke_mortality_sd = 8.7, |
| 70 | + tia_mean = 1.8, tia_sd = 2.3, |
| 71 | + neuro_mean = 4.0, neuro_sd = 5.0, |
| 72 | + other_mean = 3.8, other_sd = 5.2 |
| 73 | +) { |
| 74 | + list( |
| 75 | + stroke_noesd = list(mean = stroke_noesd_mean, sd = stroke_noesd_sd), |
| 76 | + stroke_esd = list(mean = stroke_esd_mean, sd = stroke_esd_sd), |
| 77 | + stroke_mortality = list(mean = stroke_mortality_mean, sd = stroke_mortality_sd), |
| 78 | + tia = list(mean = tia_mean, sd = tia_sd), |
| 79 | + neuro = list(mean = neuro_mean, sd = neuro_sd), |
| 80 | + other = list(mean = other_mean, sd = other_sd) |
| 81 | + ) |
| 82 | +} |
| 83 | + |
| 84 | +#' Rehabilitation unit length of stay (LOS) distributions (days). |
| 85 | +#' |
| 86 | +#' @param stroke_noesd_mean Numeric. Mean LOS for stroke patients without early |
| 87 | +#' supported discharged (ESD). |
| 88 | +#' @param stroke_noesd_sd Numeric. SD LOS for stroke patients without ESD. |
| 89 | +#' @param stroke_esd_mean Numeric. Mean LOS for stroke patients with ESD. |
| 90 | +#' @param stroke_esd_sd Numeric. SD LOS for stroke patients with ESD. |
| 91 | +#' @param tia_mean Numeric. Mean LOS for transient ischemic attack (TIA) |
| 92 | +#' patients. |
| 93 | +#' @param tia_sd Numeric. SD LOS for TIA patients. |
| 94 | +#' @param neuro_mean Numeric. Mean LOS for complex neurological patients |
| 95 | +#' @param neuro_sd Numeric. SD LOS for complex neurological patients |
| 96 | +#' @param other_mean Numeric. Mean LOS for other patients. |
| 97 | +#' @param other_sd Numeric. SD LOS for other patients. |
| 98 | +#' |
| 99 | +#' @return A named list of LOS distributions for rehabilitation unit. |
| 100 | +create_rehab_los <- function( |
| 101 | + stroke_noesd_mean = 28.4, stroke_noesd_sd = 27.2, |
| 102 | + stroke_esd_mean = 30.3, stroke_esd_sd = 23.1, |
| 103 | + tia_mean = 18.7, tia_sd = 23.5, |
| 104 | + neuro_mean = 27.6, neuro_sd = 28.4, |
| 105 | + other_mean = 16.1, other_sd = 14.1 |
| 106 | +) { |
| 107 | + list( |
| 108 | + stroke_noesd = list(mean = stroke_noesd_mean, sd = stroke_noesd_sd), |
| 109 | + stroke_esd = list(mean = stroke_esd_mean, sd = stroke_esd_sd), |
| 110 | + tia = list(mean = tia_mean, sd = tia_sd), |
| 111 | + neuro = list(mean = neuro_mean, sd = neuro_sd), |
| 112 | + other = list(mean = other_mean, sd = other_sd) |
| 113 | + ) |
| 114 | +} |
| 115 | + |
| 116 | +#' ASU routing probabilities. |
| 117 | +#' |
| 118 | +#' Probabilities of each patient type being transferred from the acute |
| 119 | +#' stroke unit (ASU) to other destinations. |
| 120 | +#' |
| 121 | +#' @param stroke_rehab Numeric. Probability stroke patient to rehab. |
| 122 | +#' @param stroke_esd Numeric. Probability stroke patient to early supported |
| 123 | +#' discharge (ESD) services. |
| 124 | +#' @param stroke_other Numeric. Probability stroke patient to other |
| 125 | +#' destinations (e.g., own home, care home, mortality). |
| 126 | +#' @param tia_rehab Numeric. Probability transient ischemic attack (TIA) |
| 127 | +#' patient to rehab. |
| 128 | +#' @param tia_esd Numeric. Probability TIA patient to ESD. |
| 129 | +#' @param tia_other Numeric. Probability TIA patient to other. |
| 130 | +#' @param neuro_rehab Numeric. Probability complex neurological patient to |
| 131 | +#' rehab. |
| 132 | +#' @param neuro_esd Numeric. Probability complex neurological patient to ESD. |
| 133 | +#' @param neuro_other Numeric. Probability complex neurological patient to |
| 134 | +#' other. |
| 135 | +#' @param other_rehab Numeric. Probability other patient to rehab. |
| 136 | +#' @param other_esd Numeric. Probability other patient to ESD. |
| 137 | +#' @param other_other Numeric. Probability other patient to other. |
| 138 | +#' |
| 139 | +#' @return A named list of routing probabilities for ASU. |
| 140 | +create_asu_routing <- function( |
| 141 | + stroke_rehab = 0.24, stroke_esd = 0.13, stroke_other = 0.63, |
| 142 | + tia_rehab = 0.01, tia_esd = 0.01, tia_other = 0.98, |
| 143 | + neuro_rehab = 0.11, neuro_esd = 0.05, neuro_other = 0.84, |
| 144 | + other_rehab = 0.05, other_esd = 0.10, other_other = 0.85 |
| 145 | +) { |
| 146 | + list( |
| 147 | + stroke = list(rehab = stroke_rehab, esd = stroke_esd, other = stroke_other), |
| 148 | + tia = list(rehab = tia_rehab, esd = tia_esd, other = tia_other), |
| 149 | + neuro = list(rehab = neuro_rehab, esd = neuro_esd, other = neuro_other), |
| 150 | + other = list(rehab = other_rehab, esd = other_esd, other = other_other) |
| 151 | + ) |
| 152 | +} |
| 153 | + |
| 154 | +#' Rehabilitation unit routing probabilities. |
| 155 | +#' |
| 156 | +#' Probabilities of each patient type being transferred from the rehabilitation |
| 157 | +#' unit to other destinations. |
| 158 | +#' |
| 159 | +#' @param stroke_esd Numeric. Probability stroke patient to early supported |
| 160 | +#' discharge (ESD) services. |
| 161 | +#' @param stroke_other Numeric. Probability stroke patient to other |
| 162 | +#' destinations (e.g., own home, care home, mortality). |
| 163 | +#' @param tia_esd Numeric. Probability transient ischemic attack (TIA) patient |
| 164 | +#' to ESD. |
| 165 | +#' @param tia_other Numeric. Probability TIA patient to other. |
| 166 | +#' @param neuro_esd Numeric. Probability complex neurological patient to ESD. |
| 167 | +#' @param neuro_other Numeric. Probability complex neurological patient to |
| 168 | +#' other. |
| 169 | +#' @param other_esd Numeric. Probability other patient to ESD. |
| 170 | +#' @param other_other Numeric. Probability other patient to other. |
| 171 | +#' |
| 172 | +#' @return A named list of routing probabilities for rehabilitation unit. |
| 173 | +create_rehab_routing <- function( |
| 174 | + stroke_esd = 0.40, stroke_other = 0.60, |
| 175 | + tia_esd = 0, tia_other = 1, |
| 176 | + neuro_esd = 0.09, neuro_other = 0.91, |
| 177 | + other_esd = 0.13, other_other = 0.88 |
| 178 | +) { |
| 179 | + list( |
| 180 | + stroke = list(esd = stroke_esd, other = stroke_other), |
| 181 | + tia = list(esd = tia_esd, other = tia_other), |
| 182 | + neuro = list(esd = neuro_esd, other = neuro_other), |
| 183 | + other = list(esd = other_esd, other = other_other) |
| 184 | + ) |
| 185 | +} |
| 186 | + |
| 187 | +#' Generate complete parameter list for simulation. |
| 188 | +#' |
| 189 | +#' @param asu_arrivals List. Acute stroke unit (ASU) arrival intervals. |
| 190 | +#' @param rehab_arrivals List. Rehabilitation unit arrival intervals. |
| 191 | +#' @param asu_los List. ASU length of stay (LOS) distributions. |
| 192 | +#' @param rehab_los List. Rehabilitation unit LOS distributions. |
| 193 | +#' @param asu_routing List. ASU routing probabilities. |
| 194 | +#' @param rehab_routing List. Rehabilitation unit routing probabilities. |
| 195 | +#' @param warm_up_period Integer. Length of warm-up period (days). |
| 196 | +#' @param data_collection_period Integer. Length of data collection period |
| 197 | +#' (days). |
| 198 | +#' @param number_of_runs Integer. Number of simulation runs. |
| 199 | +#' @param audit_interval Numeric. Audit interval (days). |
| 200 | +#' @param cores Integer. Number of CPU cores to use. |
| 201 | +#' |
| 202 | +#' @return A named list of all simulation parameters. |
| 203 | +create_parameters <- function( |
| 204 | + asu_arrivals = create_asu_arrivals(), |
| 205 | + rehab_arrivals = create_rehab_arrivals(), |
| 206 | + asu_los = create_asu_los(), |
| 207 | + rehab_los = create_rehab_los(), |
| 208 | + asu_routing = create_asu_routing(), |
| 209 | + rehab_routing = create_rehab_routing(), |
| 210 | + warm_up_period = 365 * 3, |
| 211 | + data_collection_period = 365 * 5, |
| 212 | + number_of_runs = 150, |
| 213 | + audit_interval = 1, |
| 214 | + cores = 1 |
| 215 | +) { |
| 216 | + list( |
| 217 | + asu_arrivals = asu_arrivals, |
| 218 | + rehab_arrivals = rehab_arrivals, |
| 219 | + asu_los = asu_los, |
| 220 | + rehab_los = rehab_los, |
| 221 | + asu_routing = asu_routing, |
| 222 | + rehab_routing = rehab_routing, |
| 223 | + warm_up_period = warm_up_period, |
| 224 | + data_collection_period = data_collection_period, |
| 225 | + number_of_runs = number_of_runs, |
| 226 | + audit_interval = audit_interval, |
| 227 | + cores = cores |
| 228 | + ) |
| 229 | +} |
0 commit comments