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
[](https://app.codecov.io/gh/MSDLLCpapers/dynacem)
20
22
<!-- badges: end -->
21
23
22
24
The goal of *dynacem* is to evaluates cost-effectiveness models with dynamic pricing and uptake.
@@ -28,18 +30,24 @@ Cost-effectiveness models are conventionally developed for single cohorts withou
28
30
You can install the development version of dynacem from [GitHub](https://github.com/) with:
29
31
30
32
```{r install}
31
-
# install.packages("pak")
32
-
# pak::pak("MSDLLCpapers/dynacem")
33
+
#| eval: false
34
+
install.packages("pak")
35
+
pak::pak("MSDLLCpapers/dynacem")
33
36
```
34
37
35
38
## Example
36
39
37
40
Some example present value calculations are provided below for a single payoff. A typical cost-effectiveness model may involve several separate payoffs, for each intevention modeled, each with their own price index and discount rate.
38
41
42
+
### Obtain payoffs vector
43
+
44
+
In this case, we call out the drug acquisition cost of the new intervention (*cost_daq_new*), the total cost (*cost_total*) and QALYs (*qaly*) accumulated in each timestep. The *get_dynfields()* function will also calculated 'rolled-up' values as at the start of each timestep rather than discounted to time zero.
45
+
39
46
```{r getdata}
40
47
# Load the dynacem package
41
48
library(dynacem)
42
49
library(ggplot2)
50
+
library(tidyr)
43
51
44
52
# Review oncpsm model (heemod object)
45
53
oncpsm
@@ -51,15 +59,27 @@ democe <- get_dynfields(
51
59
discount = "disc"
52
60
)
53
61
head(democe)
62
+
```
63
+
64
+
For this example, we are just interested in the payoff for drug acquisition costs of the new intervention.
Now let us calculate a discounted present value, given dynamic uptake (of one patient per timestep) and dynamic pricing. We assume that there are 52 timesteps per year and a discount rate of 3% (real) per year. The general rate of inflation is 5% per year. The underlying price of the payoff being costed rises with inflation of 5% for the first three years, then drops by 50%, where it rises by 4% per year.
74
+
### Define dynamic pricing and uptake
75
+
76
+
Now let us calculate a discounted present value, given dynamic uptake of one patient per timestep, and dynamic pricing.
77
+
78
+
- We assume that there are 52 timesteps per year and a discount rate of 3% (real) per year.
79
+
- The general rate of inflation is 5% per year.
80
+
- The underlying price of the payoff being costed rises with inflation of 5% for the first three years, then drops by 50%, after which it rises by 4% per year.
81
+
82
+
We create a price index twice as long as we need right now for reasons that should become clear later.
ggplot2::ggplot(dsprices, aes(x = years, y = prices)) +
81
-
geom_line()
99
+
) |>
100
+
ggplot2::ggplot(aes(x = years, y = prices)) +
101
+
ggplot2::geom_line() +
102
+
ylim(0, 1.5)
103
+
```
104
+
105
+
### Calculate current present value
82
106
83
-
# Calculate total discounted present value, given dynamic uptake and pricing
107
+
Now with the payoff, uptake, pricing and discount rate set, we can call the *dynpv()* function and calculate the present value of the payoff.
108
+
109
+
```{r calc_pv}
110
+
# Calculate total discounted present value of drug acquisition costs, given dynamic uptake and pricing
84
111
pv1 <- dynpv(
85
112
uptakes = rep(1, Nt),
86
-
payoffs = payoffs$cost_oth,
113
+
payoffs = payoffs$cost_daq_new_rup,
87
114
prices = prices[1:Nt],
88
115
disc = disc_pt
89
116
)
90
117
pv1$results
91
118
```
92
119
93
-
We also wish to calculate discounted present values into the future, say every annually for 10 years. We need a price index that lasts 30 years (20 year time horizon + up to 10 years of future evaluations). We would expect this to change over time due to the price index.
120
+
### Present values into the future
121
+
122
+
We also wish to calculate discounted present values (PV) into the future, say every annually for 10 years.
123
+
124
+
We need a price index that lasts 30 years (20 year time horizon + up to 10 years of future evaluations). Fortunately our price index is 40 years long (2 x 20).
125
+
126
+
We would expect the PV to change over time. The nominal PV will increase over time due to price inflation of of this payoff of 4\% per year. The real PV will decrease because the rate of price inflation of this particular payoff (4\% per year) is less than the general rate of inflation (5\% per year) factored into the nominal discount rate (8\% per year).
94
127
95
128
```{r calc2}
96
129
# Present value at time 1, 53, 105, ...
97
130
pv2 <- futurepv(
98
-
l = (1:10)*52 - 51,
99
-
payoffs = payoffs$cost_oth,
131
+
l = (1:11)*52 - 51,
132
+
payoffs = payoffs$cost_daq_new_rup,
100
133
prices = prices,
101
134
disc = disc_pt
102
135
)
103
-
pv2$results
104
-
```
136
+
137
+
# Obtain a dataset of the real and nominal ICER over time
0 commit comments