Find the value of p1 that achieves a target waiting time percentile
find_p.Rd
Uses a binary search algorithm to find the value of p1
(the proportion
parameter) that achieves a specified target waiting time (target_time
)
at a given percentile (hardcoded as 92nd percentile) of the cumulative
waiting list size, given a treatment capacity in the first month
(mu_1
) and other parameters.
Usage
find_p(
target_time = 18/4.35,
renege_params,
mu_1,
p1_lower = 0.1,
p1_upper = 0.85,
tolerance = 0.001,
referrals,
percentile = 0.92,
max_iterations = 15
)
Arguments
- target_time
numeric of length 1; the target waiting time, in weeks, to achieve the specified percentile.
- renege_params
numeric; proportion (0 ≤ rm ≤ 1) of waiting patients reneging in the m-th month of waiting, where r2 = 0.1 refers to 10% of those in the second month of waiting reneging.
- mu_1
numeric of length 1; treatment capacity in the first month.
- p1_lower
numeric of length 1; lower bound for the binary search of
p1
. Must be between 0 and 1 and less thanp1_upper
. Defaults to 0.1.- p1_upper
numeric of length 1; upper bound for the binary search of
p1
. Must be between 0 and 1 and more thanp1_lower
. Defaults to 0.85.- tolerance
numeric of length 1; tolerance for the binary search stopping criterion. The unit is weeks.
- referrals
numeric of length 1; value representing the steady-state number of referrals.
- percentile
Numeric value between 0 and 1 indicating the desired percentile (default is 0.92).
- max_iterations
numeric of length 1; maximum number of iterations to search for a valid result
Value
A list containing:
- p1
The value of
p1
found to achieve the target waiting time.- time_p
The interpolated waiting time at the specified percentile.
- mu
The total number of treatments required when the solution is found.
- wlsize
The total size of the waiting list when the solution is found.
- waiting_list
The data frame with historical data formatted and waiting list sizes calculated.
- niterations
The number of iterations performed in the binary search.
Where there are NAs included in the results, this indicates that a solution couldn't be found.
Details
The function repeatedly uses the removals table (from initialise_removals()
)
and calculates waiting list sizes for candidate values of p1
, using binary search to
home in on the value that achieves the target waiting time at the required
percentile. The search stops when the difference between upper and lower
bounds is less than tolerance
, or when the calculated waiting time is
within tolerance
of the target.
Examples
find_p(
target_time = 18 / 4.35,
renege_params = c(0.04, 0.04, 0.03, 0.01, 0.02, 0.02, 0.01),
mu_1 = 2651.227,
p1_lower = 0.1,
p1_upper = 0.85,
tolerance = 0.001,
referrals = 12000,
percentile = 0.92
)
#> $p1
#> [1] 0.8199707
#>
#> $time_p
#> [1] 4.137243
#>
#> $mu
#> [1] 10833
#>
#> $wlsize
#> [1] 24625
#>
#> $waiting_list
#> months_waited_id r service sigma wlsize
#> 1 0 0.04 2651 2651 8869
#> 2 1 0.04 2174 2174 6340
#> 3 2 0.03 1783 1783 4366
#> 4 3 0.01 1462 1462 2860
#> 5 4 0.02 1199 1199 1603
#> 6 5 0.02 983 983 587
#> 7 6 0.01 4350 581 0
#>
#> $niterations
#> [1] 10
#>