| futurepv | R Documentation |
Present 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)
tzero |
Time at the date of calculation, to be used in lookup in prices vector |
payoffs |
Vector of payoffs of interest (numeric vector) |
prices |
Vector of price indices through the time horizon of interest |
discrate |
Discount rate per timestep, corresponding to price index |
A tibble of class "dynpv" with the following columns:
j: Time at which patients began treatment
k: Time since patients began treatment
l: Time offset for the price index (from tzero)
t: Equals j+k-1
uj: Uptake of patients beginning treatment at time j (from uptakes)
pk: Cashflow amount in today's money in respect of patients at time k since starting treatment (from payoffs)
R: Index of prices over time l+t (from prices)
v: Discounting factors, (1+i)^{1-t}, where i is the discount rate per timestep
pv: Present value, PV(j,k,l)
dynpv()
library(dplyr)
# 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 |>
filter(int=="new") |>
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
summary(fpv)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.