R/future.R
futurepv.RdPresent value of a series of payoffs for a single given cohort, entering at given future time, allowing for dynamic pricing. This function is a wrapper for dynpv() restricted to evaluation of a single cohort.
futurepv(tzero = 0, payoffs, prices, discrate)A list inputs, results and pv.
The inputs list contains a list of the following parameters called with the function: uptakes, payoffs, horizon, tzero, prices, and discrate.
The results output is a class_dynpv() S7 object that contains the following elements:
name: Name given to the object
df: Tibble of calculation results
ncoh: Number of cohorts of uptaking patients (always 1)
ntimes: Number of times (unique values of tzero) at which calculations are performed
uptake: Total number of uptaking patients (always 1)
total: Total present value
mean: Average present value per uptaking patient (=total/uptake)
sum_by_coh: Tibble of summarized calculation results for each uptake cohort
inputs: list contains a list of the following parameters called with the function: uptakes, payoffs, horizon, tzero, prices, and discrate.
The pv output is numeric, a convenience value equal to $results$mean.
# Obtain dataset
democe <- get_dynfields(
heemodel = oncpsm,
payoffs = c("cost_daq_new", "cost_total", "qaly"),
discount = "disc"
)
# Obtain discount rate
discrate <- get_param_value(oncpsm, "disc")
# Obtain payoff vector of interest
payoffs <- democe |>
dplyr::filter(int=="new") |>
dplyr::mutate(cost_oth_rup = cost_total_rup - cost_daq_new_rup)
Nt <- nrow(payoffs)
# Run calculation for times 0-9
fpv <- futurepv(
tzero = (0:9)*52,
payoffs = payoffs$cost_oth_rup,
prices = 1.001^(1:(2*Nt)-1), # Approx 5.3% every 52 steps
discrate = 0.001 + discrate
)
fpv$results
#> This is a dynamicpv::class_dynpv S7 object, named NA .
#> Number of cohorts: 1044
#> Number of times: 10
#>
#> Uptake, total and mean present values by timepoint:
#> # A tibble: 10 × 4
#> tzero uptake total mean
#> <dbl> <dbl> <dbl> <dbl>
#> 1 0 1 52165. 52165.
#> 2 52 1 54948. 54948.
#> 3 104 1 57880. 57880.
#> 4 156 1 60967. 60967.
#> 5 208 1 64220. 64220.
#> 6 260 1 67646. 67646.
#> 7 312 1 71255. 71255.
#> 8 364 1 75056. 75056.
#> 9 416 1 79060. 79060.
#> 10 468 1 83278. 83278.
#>
#> The full dataset is available using @df.
fpv$pv
#> # A tibble: 10 × 2
#> tzero mean
#> <dbl> <dbl>
#> 1 0 52165.
#> 2 52 54948.
#> 3 104 57880.
#> 4 156 60967.
#> 5 208 64220.
#> 6 260 67646.
#> 7 312 71255.
#> 8 364 75056.
#> 9 416 79060.
#> 10 468 83278.