Present value of a payoff affected by dynamic pricing, with uptake across multiple cohorts (dynamic uptake)

dynpv(
  uptakes = 1,
  payoffs,
  horizon = length(payoffs),
  tzero = 0,
  prices = rep(1, length(payoffs) + tzero),
  discrate = 0,
  dpv_name = NA_character_
)

Arguments

uptakes

Vector of patient uptake over time

payoffs

Vector of payoffs of interest (numeric vector)

horizon

Time horizon for the calculation (length must be less than or equal to the length of payoffs)

tzero

Time at the date of calculation, to be used in lookup in prices vector

prices

Vector of price indices through the time horizon of interest

discrate

Discount rate per timestep, corresponding to price index

dpv_name

Name to be given to Dynamic Present Value object created by this function call

Value

A list containing inputs and results. 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

  • ntimes: Number of times (unique values of tzero) at which calculations are performed

  • uptake: Total number of uptaking patients

  • 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

Examples

# Obtain dataset
democe <- get_dynfields(
   heemodel = oncpsm,
   payoffs = c("cost_daq_new", "cost_total", "qaly"),
   discount = "disc"
   )

# Obtain short payoff vector of interest
payoffs <- democe |>
   dplyr::filter(int=="new", model_time<11) |>
   dplyr::mutate(cost_oth = cost_total - cost_daq_new)
Nt <- nrow(payoffs)

# Example calculation
dynpv(
   uptakes = rep(1, Nt),
   payoffs = payoffs$cost_oth,
   prices = 1 + (0:(Nt-1))*0.05,
   discrate = 0.08 
)
#> $inputs
#> $inputs$uptakes
#>  [1] 1 1 1 1 1 1 1 1 1 1
#> 
#> $inputs$payoffs
#>  [1] 354.8228 354.3419 353.7327 352.9161 351.8567 350.5507 349.0109 347.2584
#>  [9] 345.3166 343.2095
#> 
#> $inputs$horizon
#> [1] 10
#> 
#> $inputs$tzero
#> [1] 0
#> 
#> $inputs$prices
#>  [1] 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45
#> 
#> $inputs$discrate
#> [1] 0.08
#> 
#> 
#> $results
#> This is a dynamicpv::class_dynpv S7 object, named NA . 
#>      Number of cohorts:             10 
#>      Number of times:               1 
#>      Total uptake:                  10 
#>      Total present value:           15869.53 
#>      Mean present value:            1586.953 
#> 
#>  The full dataset is available using @df. 
#>