-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
bugSomething isn't workingSomething isn't workingdocumentationImprovements or additions to documentationImprovements or additions to documentation
Description
Difference between formula in help and that what the function actually does.
Help file suggests:
- Division by waiting time instead of multiplication. This is fine, as it is reversed and equivalent mathematically, just different to help.
- Function divided sum of squared coefficients of variation by 2, and formula in help does not. Not sure which is correct.
NHSRwaitinglist/R/calc_target_capacity.R
Lines 6 to 43 in f1f5434
| #' capacity = demand + (cvd**2 + cvc**2) / waiting_time | |
| #' | |
| #' where | |
| #' cvd = coefficient of variation of time between arrivals | |
| #' cvd = coefficient of variation of service times | |
| #' waiting_time = target_wait / factor | |
| #' | |
| #' @param demand Numeric value of rate of demand in same units as target wait | |
| #' e.g. if target wait is weeks, then demand in units of patients/week. | |
| #' @param target_wait Numeric value of number of weeks that has been set as the | |
| #' target within which the patient should be seen. | |
| #' @param factor the amount we divide the target by in the waiting list | |
| #' e.g. if target is 52 weeks the mean wait should be 13 for a factor of 4 | |
| #' @param cv_demand coefficient of variation of time between arrivals | |
| #' @param cv_capacity coefficient of variation between removals due to | |
| #' operations completed | |
| #' | |
| #' @return numeric. The capacity required to achieve a target waiting time. | |
| #' @export | |
| #' | |
| #' @examples | |
| #' | |
| #' demand <- 4 # weeks | |
| #' target_wait <- 52 # weeks | |
| #' | |
| #' # number of operations per week to have mean wait of 52/4 | |
| #' calc_target_capacity(demand, target_wait) | |
| #' | |
| calc_target_capacity <- function( | |
| demand, | |
| target_wait, | |
| factor = 4, | |
| cv_demand = 1, | |
| cv_capacity = 1 | |
| ) { | |
| check_class(demand, target_wait, factor, cv_demand, cv_capacity) | |
| target_cap <- | |
| demand + ((cv_demand**2 + cv_capacity**2) / 2) * (factor / target_wait) |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdocumentationImprovements or additions to documentationImprovements or additions to documentation