You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/dynamic.R
+54-20Lines changed: 54 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -16,28 +16,64 @@
16
16
# You should have received a copy of the GNU General Public License
17
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
19
-
#' Calculate present value for a payoff with dynamic pricing and dynamic uptake
19
+
#' Present values with dynamic pricing and dynamic uptake
20
+
#'
21
+
#' Calculate present value for a payoff with dynamic (lifecycle) pricing and dynamic uptake (stacked cohorts).
20
22
#'
21
-
#' Present value of a payoff affected by dynamic pricing, with uptake across multiple cohorts (dynamic uptake)
23
+
#' Suppose payoffs in relation to patients receiving treatment (such as costs or health outcomes) occur over timesteps \eqn{t=1, ..., T}. Let us partition time as follows.
24
+
#'
25
+
#' - Suppose \eqn{j=1,...,T} indexes the time at which the patient begins treatment.
26
+
#' - Suppose \eqn{k=1,...,T} indexes time since initiating treatment.
27
+
#'
28
+
#' In general, \eqn{t=j+k-1}, and we are interested in the set of \eqn{(j,k)} such that \eqn{1 \leq t \leq T}.
29
+
#'
30
+
#' For example, \eqn{t=3} comprises:
31
+
#'
32
+
#' - patients who are in the third timestep of treatment that began in timestep 1: (j,k)=(1,3);
33
+
#' - patients who are in the second timestep of treatment that began in timestep 2, (j,k)=(2,2); and
34
+
#' - patients who are in the first timestep of treatment that began in timestep 3, (j,k)=(3,1)
35
+
#'
36
+
#' The [Present Value](https://en.wikipedia.org/wiki/Present_value) of a cashflow \eqn{p_k} for the \eqn{u_j} patients who began treatment at time \eqn{j} and who are in their \eqn{k}th timestep of treatment is as follows
#' where \eqn{i} is the risk-free discount rate per timestep, \eqn{p_k} is the cashflow amount in today’s money, and \eqn{p_k \cdot R_{j+k+l-1}} is the nominal amount of the cashflow at the time it is incurred, allowing for an offset of \eqn{l = tzero}.
39
+
#'
40
+
#' The total present value, \eqn{TPV(l)}, is therefore the sum over all \eqn{j} and \eqn{k} within the time horizon \eqn{T}, namely:
#' Tibble of summarized calculation results for each uptake cohort (sum_by_coh)
127
+
#' Present value for each uptake cohort and calculation time
123
128
#'
129
+
#' Calculates the sum of the Present Value by uptake cohort (`j`) and time at which the calculation is performed (`tzero` input to [dynpv()])
130
+
#'
131
+
#' The [Present Value](https://en.wikipedia.org/wiki/Present_value) of a cashflow \eqn{p_k} for the \eqn{u_j} patients who began treatment at time \eqn{j} and who are in their \eqn{k}th timestep of treatment is as follows
#' where \eqn{i} is the risk-free discount rate per timestep, \eqn{p_k} is the cashflow amount in today’s money, and \eqn{p_k \cdot R_{j+k+l-1}} is the nominal amount of the cashflow at the time it is incurred, allowing for an offset of \eqn{l = tzero}.
134
+
#'
135
+
#' This method returns \eqn{\sum_{k=1}^{T-j+1} PV(j,k,l)} for each value of \eqn{j} and \eqn{l}, where \eqn{T} is the time horizon of the calculation.
#' Sum of the Present Value, by time at which the calculation is performed (`tzero` input to [dynpv()])
155
+
#'
156
+
#' The [Present Value](https://en.wikipedia.org/wiki/Present_value) of a cashflow \eqn{p_k} for the \eqn{u_j} patients who began treatment at time \eqn{j} and who are in their \eqn{k}th timestep of treatment is as follows
#' where \eqn{i} is the risk-free discount rate per timestep, \eqn{p_k} is the cashflow amount in today’s money, and \eqn{p_k \cdot R_{j+k+l-1}} is the nominal amount of the cashflow at the time it is incurred, allowing for an offset of \eqn{l = tzero}.
159
+
#'
160
+
#' The total present value by time at which the calculation is performed, \eqn{TPV(l)}, is therefore the sum of \eqn{PV(j,k,l)} over all \eqn{j} and \eqn{k} within the time horizon \eqn{T}, namely:
Copy file name to clipboardExpand all lines: README.Rmd
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ knitr::opts_chunk$set(
23
23
24
24
The goal of *dynamicpv* is to evaluate present values and cost-effectiveness with dynamic pricing and uptake.
25
25
26
-
Through the `dynamicpv::dynpv()` function, the package provides calculations of the present values of costs, life years, QALYs or other payoffs allowing for dynamic uptake (also known as multiple cohorts) and dynamic pricing (also known as life-cycle). The starting point is a conventional cohort cost-effectiveness model, such as one computed using the [heemod](https://cran.r-project.org/package=heemod) package.
26
+
Through the [dynpv()](https://msdllcpapers.github.io/dynacem/reference/dynpv.html) function, the package provides calculations of the present values of costs, life years, QALYs or other payoffs allowing for dynamic uptake (also known as multiple cohorts) and dynamic pricing (also known as life-cycle). The starting point is a conventional cohort cost-effectiveness model, such as one computed using the [heemod](https://cran.r-project.org/package=heemod) package.
0 commit comments