Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ jobs:
with:
extra-packages: any::rcmdcheck
needs: check
# Newly added line suggested by Github Copilot - cache instead of cache-key
cache: ${{ runner.os }}-r-deps

- uses: r-lib/actions/check-r-package@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Authors@R: c(
)
Description: Evaluates present values and cost-effectiveness with dynamic pricing and uptake.
License: GPL (>= 3)
URL: https://MSDLLCpapers.github.io/dynacem/, https://github.com/MSDLLCpapers/dynacem
BugReports: https://github.com/MSDLLCpapers/dynacem/issues
URL: https://MSDLLCpapers.github.io/dynamicpv/, https://github.com/MSDLLCpapers/dynamicpv
BugReports: https://github.com/MSDLLCpapers/dynamipv/issues
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
Expand Down
20 changes: 10 additions & 10 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ knitr::opts_chunk$set(

<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/MSDLLCpapers/dynacem/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/MSDLLCpapers/dynacem/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/MSDLLCpapers/dynacem/graph/badge.svg)](https://app.codecov.io/gh/MSDLLCpapers/dynacem)
[![R-CMD-check](https://github.com/MSDLLCpapers/dynamicpv/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/MSDLLCpapers/dynamicpv/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/MSDLLCpapers/dynamicpv/graph/badge.svg)](https://app.codecov.io/gh/MSDLLCpapers/dynamicpv)
<!-- badges: end -->

The goal of *dynamicpv* is to evaluate present values and cost-effectiveness with dynamic pricing and uptake.

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.
Through the [dynpv()](https://msdllcpapers.github.io/dynamicpv/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.

## Installation

Expand All @@ -34,15 +34,15 @@ You can install the development version of *dynamicpv* from [GitHub](https://git
# Install devtools package if not already installed
install.packages("devtools")

# Install dynamicpv using pak, from MSD's dynacem repository
pak::pak("MSDLLCpapers/dynacem")
# Install dynamicpv using pak from MSD repository
pak::pak("MSDLLCpapers/dynamicpv")
```

Note that the above does not install vignettes. Vignettes may be viewed on the [package website](https://msdllcpapers.github.io/dynacem) or by instead running the following.

```{r instal2}
#| eval: false
devtools::install_github("MSDLLCpapers/dynacem", build_vignettes=TRUE)
devtools::install_github("MSDLLCpapers/dynamicpv", build_vignettes=TRUE)
```

You should then load the package, alongside some other packages used here.
Expand All @@ -63,11 +63,11 @@ library(tidyr)

There are four vignettes provided.

1. The [Dynamic Pricing](https://msdllcpapers.github.io/dynacem/articles/dynamic-pricing.html) vignette (`vignette("dynamic-pricing")`) describes how present values may be calculated in the package from a payoff vector, allowing for the prices of the resources costed to be dynamic.
1. The [Dynamic Pricing](https://msdllcpapers.github.io/dynamicpv/articles/dynamic-pricing.html) vignette (`vignette("dynamic-pricing")`) describes how present values may be calculated in the package from a payoff vector, allowing for the prices of the resources costed to be dynamic.

2. The [Dynamic Uptake](https://msdllcpapers.github.io/dynacem/articles/dynamic-uptake.html) vignette (`vignette("dynamic-uptake")`) explores further how present values can be derived allowing for dynamic uptake. This is in contrast to the non-dynamic approach of calculating a present value for a single cohort of patients. This is analogous to the use by general insurance actuaries of run-off triangles.
2. The [Dynamic Uptake](https://msdllcpapers.github.io/dynamicpv/articles/dynamic-uptake.html) vignette (`vignette("dynamic-uptake")`) explores further how present values can be derived allowing for dynamic uptake. This is in contrast to the non-dynamic approach of calculating a present value for a single cohort of patients. This is analogous to the use by general insurance actuaries of run-off triangles.

3. The [Cost-Effectiveness Applications](https://msdllcpapers.github.io/dynacem/articles/cost-effectiveness-applications.html) (`vignette(cost-effectiveness-applications")`) vignette describes how, given a static cost-effectiveness model (single cohort, prices constant in real terms), Incremental Cost-Effectiveness Ratios may be calculated that allow for dynamic pricing and/or dynamic uptake. This is illustrated by taking an example three-state partitioned survival model of a new intervention for an oncology indication compared to standard of care, with stated assumptions for how pricing and uptake may be dynamic. Nominal and Real ICERs are plotted over time, illustrating the impact of the loss of exclusivity points for each intervention.
3. The [Cost-Effectiveness Applications](https://msdllcpapers.github.io/dynamicpv/articles/cost-effectiveness-applications.html) (`vignette(cost-effectiveness-applications")`) vignette describes how, given a static cost-effectiveness model (single cohort, prices constant in real terms), Incremental Cost-Effectiveness Ratios may be calculated that allow for dynamic pricing and/or dynamic uptake. This is illustrated by taking an example three-state partitioned survival model of a new intervention for an oncology indication compared to standard of care, with stated assumptions for how pricing and uptake may be dynamic. Nominal and Real ICERs are plotted over time, illustrating the impact of the loss of exclusivity points for each intervention.

4. The [Budget Impact Applications](https://msdllcpapers.github.io/dynacem/articles/budget-impact-applications.html) (`vignette("budget-impact-applications")`) vignette describes how, given a static cost-effectiveness model (single cohort, prices constant in real terms) and dynamic uptake, a budget impact can be readily calculated. The calculations are repeated with the dynamic pricing assumptions to illustrate how easily this can be done, and examine the differences between a budget impact assessment with and without dynamic pricing.
4. The [Budget Impact Applications](https://msdllcpapers.github.io/dynamicpv/articles/budget-impact-applications.html) (`vignette("budget-impact-applications")`) vignette describes how, given a static cost-effectiveness model (single cohort, prices constant in real terms) and dynamic uptake, a budget impact can be readily calculated. The calculations are repeated with the dynamic pricing assumptions to illustrate how easily this can be done, and examine the differences between a budget impact assessment with and without dynamic pricing.

1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
url: https://MSDLLCpapers.github.io/dynacem/
template:
bootstrap: 5
math-rendering: mathjax

reference:
- title: Key functions and datasets
Expand Down
6 changes: 3 additions & 3 deletions man/dynamicpv-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 36 additions & 12 deletions vignettes/cost-effectiveness-applications.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -425,56 +425,61 @@ head(hemout_new)
With non-dynamic uptake, we use `uptakes`=`uptake_single`=1. Drug acquisition costs are constant in real terms (`prices=prices_static`) and are discounted at the risk-free real rate (`discrate=disc_cycle`). Other costs rise in line with general price inflation (`prices=prices_oth`) and are discounted at nominal discount rates (`discrate=nomdisc_cycle`). QALYs are not affected by price inflation (`prices=prices_static`) and are discounted at the risk-free real rate (`discrate=disc_cycle`).

```{r scen1}
# SOC
# SOC, costs other than drug acquisition
s1_soc_othcost <- dynamicpv::dynpv(
uptakes = uptake_single,
payoffs = hemout_soc$cost_nondaq_rup,
prices = prices_oth,
discrate = nomdisc_cycle
)

# SOC, drug acquisition costs
s1_soc_daqcost <- dynamicpv::dynpv(
uptakes = uptake_single,
payoffs = hemout_soc$cost_daq_soc_rup,
prices = prices_static,
discrate = disc_cycle
)

# SOC, total costs
s1_soc_cost <- s1_soc_daqcost + s1_soc_othcost

# SOC, QALYs
s1_soc_qaly <- dynamicpv::dynpv(
uptakes = uptake_single,
payoffs = hemout_soc$qaly_rup,
prices = prices_static,
discrate = disc_cycle
)

# New intervention

# New intervention, costs other than drug acquisition
s1_new_othcost <- dynamicpv::dynpv(
uptakes = uptake_single,
payoffs = hemout_new$cost_nondaq_rup,
prices = prices_oth,
discrate = nomdisc_cycle
)

# New intervention, drug acquisition costs
s1_new_daqcost <- dynamicpv::dynpv(
uptakes = uptake_single,
payoffs = hemout_new$cost_daq_new_rup,
prices = prices_static,
discrate = disc_cycle
)

# New intervention, total costs
s1_new_cost <- s1_new_daqcost + s1_new_othcost

# New intervention, QALYs
s1_new_qaly <- dynamicpv::dynpv(
uptakes = uptake_single,
payoffs = hemout_new$qaly_rup,
prices = prices_static,
discrate = disc_cycle
)

# Incrementals
# Incremental costs, QALYs, and ICER
s1_icost <- total(s1_new_cost) - total(s1_soc_cost)
s1_iqaly <- total(s1_new_qaly) - total(s1_soc_qaly)
s1_icer <- s1_icost / s1_iqaly
Expand All @@ -487,31 +492,38 @@ These results show that the new intervention is associated with $`r s1_icost` in
The costs of drug acquisition in each arm differ in Scenario 2 through applying the relevant dynamic price index (`prices_dyn_soc` and `prices_dyn_new`), with discounting at nominal rates (`discrate = nomdisc_cycle`). Otherwise costs and QALYs are unchanged from Scenario 1.

```{r calc_scen2}
# SOC
# SOC, costs other than drug acquisition are unchanged
s2_soc_othcost <- s1_soc_othcost

# SoC, drug acquisition costs
s2_soc_daqcost <- dynamicpv::dynpv(
uptakes = uptake_single,
payoffs = hemout_soc$cost_daq_soc_rup,
prices = prices_dyn_soc,
discrate = nomdisc_cycle
)

# SoC, total costs
s2_soc_cost <- s2_soc_daqcost + s2_soc_othcost
s2_soc_qaly <- s1_soc_qaly

# New intervention
# SoC, QALYs are unchanged
s2_soc_qaly <- s1_soc_qaly

# New intervention, costs other than drug acquisition are unchanged
s2_new_othcost <- s1_new_othcost

# New intervention, drug acquisition costs
s2_new_daqcost <- dynamicpv::dynpv(
uptakes = uptake_single,
payoffs = hemout_new$cost_daq_new_rup,
prices = prices_dyn_new,
discrate = nomdisc_cycle
)

# New intervention, total costs
s2_new_cost <- s2_new_daqcost + s2_new_othcost

# New intervention, QALYs are unchanged
s2_new_qaly <- s1_new_qaly

# Incrementals
Expand All @@ -527,47 +539,53 @@ Under scenario 2, the new intervention has an incremental cost-effectiveness of
The calculation for Scenario 3 is the same as for Scenario 1 except for dynamic uptake, which is handled by setting `uptakes = uptake_multi`.

```{r calc_scen3}
# SOC
# SOC, costs other than drug acquisition
s3_soc_othcost <- dynamicpv::dynpv(
uptakes = uptake_multi,
payoffs = hemout_soc$cost_nondaq_rup,
prices = prices_oth,
discrate = nomdisc_cycle
)

# SoC, drug acquisition costs
s3_soc_daqcost <- dynamicpv::dynpv(
uptakes = uptake_multi,
payoffs = hemout_soc$cost_daq_soc_rup,
prices = prices_static,
discrate = disc_cycle
)

# SoC, total costs
s3_soc_cost <- s3_soc_daqcost + s3_soc_othcost

# SoC, QALYs
s3_soc_qaly <- dynamicpv::dynpv(
uptakes = uptake_multi,
payoffs = hemout_soc$qaly_rup,
prices = prices_static,
discrate = disc_cycle
)

# New intervention
# New intervention, costs other than drug acquisition
s3_new_othcost <- dynamicpv::dynpv(
uptakes = uptake_multi,
payoffs = hemout_new$cost_nondaq_rup,
prices = prices_oth,
discrate = nomdisc_cycle
)

# New intervention, drug acquisition costs
s3_new_daqcost <- dynamicpv::dynpv(
uptakes = uptake_multi,
payoffs = hemout_new$cost_daq_new_rup,
prices = prices_static,
discrate = disc_cycle
)

# New intervention, total costs
s3_new_cost <- s3_new_daqcost + s3_new_othcost

# New intervention, QALYs
s3_new_qaly <- dynamicpv::dynpv(
uptakes = uptake_multi,
payoffs = hemout_new$qaly_rup,
Expand All @@ -588,32 +606,38 @@ Under scenario 3, the new intervention has an incremental cost-effectiveness of
The costs of drug acquisition in each arm differ in Scenario 4 from Scenario 3 through applying the relevant dynamic price index (`prices_dyn_soc` and `prices_dyn_new`). Otherwise costs and QALYs are unchanged from Scenario 3.

```{r calc_scen4}
# SOC
# SOC, costs other than drug acquisition are unchanged
s4_soc_othcost <- s3_soc_othcost

# SoC, drug acquisition costs
s4_soc_daqcost <- dynamicpv::dynpv(
uptakes = uptake_multi,
payoffs = hemout_soc$cost_daq_soc_rup,
prices = prices_dyn_soc,
discrate = nomdisc_cycle
)

# SoC, total costs
s4_soc_cost <- s4_soc_daqcost + s4_soc_othcost

# SoC, QALYs are unchanged
s4_soc_qaly <- s3_soc_qaly

# New intervention

# New intervention, costs other than drug acquisition are unchanged
s4_new_othcost <- s3_new_othcost

# New intervention, drug acquisition costs
s4_new_daqcost <- dynamicpv::dynpv(
uptakes = uptake_multi,
payoffs = hemout_new$cost_daq_new_rup,
prices = prices_dyn_new,
discrate = nomdisc_cycle
)

# New intervention, total costs
s4_new_cost <- s4_new_daqcost + s4_new_othcost

# New intervention, QALYs
s4_new_qaly <- s3_new_qaly

# Incrementals
Expand Down