Skip to content

Commit 921f81b

Browse files
authored
Merge pull request #29 from MSDLLCpapers/revert-28-main
Revert "After CRAN submission"
2 parents 6d87384 + 868d340 commit 921f81b

File tree

9 files changed

+27
-120
lines changed

9 files changed

+27
-120
lines changed

CRAN-SUBMISSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Version: 0.4.1
2-
Date: 2026-01-10 23:19:31 UTC
3-
SHA: ed329f5dac07bdbb36b0093216bc30c4d0a57514
1+
Version: 0.4.0
2+
Date: 2026-01-07 00:45:35 UTC
3+
SHA: 986f44179c3fb67d474c9a965f5643004c47e70c

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: dynamicpv
22
Title: Evaluates Present Values and Health Economic Models with Dynamic Pricing and Uptake
3-
Version: 0.4.1.9000
3+
Version: 0.4.1
44
Authors@R: c(
55
person("Dominic", "Muston", , "dominic.muston@msd.com", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-4876-7940")),

NEWS.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# dynamicpv (development version)
2-
3-
* So far, only minor changes to the readme page
4-
51
# dynamicpv 0.4.1
62

73
* Revised vignettes

R/dynamic.R

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -98,34 +98,11 @@
9898
dynpv <- function(
9999
uptakes = 1,
100100
payoffs,
101-
horizon = NA,
101+
horizon = length(payoffs),
102102
tzero = 0,
103-
prices = NA,
103+
prices = rep(1, length(payoffs)+tzero),
104104
discrate = 0
105105
){
106-
# If payoffs are discrete
107-
if (class(payoffs)=="numeric") {
108-
# Horizon defaults to length of payoffs
109-
if (class(horizon)=="logical") {horizon <- length(payoffs)}
110-
# Price index defaults to (1, ..., 1)
111-
if (class(prices)=="logical") {prices <- rep(1, length(payoffs)+tzero)}
112-
# Call calculation
113-
dpv <- dynpv_discrete(uptakes, payoffs, horizon, tzero, prices, discrate)
114-
}
115-
# If payoffs are not discrete and uptake is discrete
116-
if ((class(uptakes)=="numeric") & (class(payoffs)=="function")) {
117-
dpv <- dynpv_semicts(uptakes, payoffs, horizon, tzero, prices, discrate)
118-
}
119-
# If payoffs and uptake are not discrete
120-
if ((class(uptakes)=="function") & (class(payoffs)=="function")) {
121-
dpv <- dynpv_fullycts(uptakes, payoffs, horizon, tzero, prices, discrate)
122-
}
123-
# Return
124-
return(dpv)
125-
}
126-
127-
# Discrete function
128-
dynpv_discrete <- function(uptakes, payoffs, horizon, tzero, prices, discrate){
129106
# Avoid no visible binding note
130107
j <- k <- l <- uj <- pk <- R <- v <- NULL
131108
# Trim
@@ -160,42 +137,3 @@ trim_vec <- function(vec){
160137
# Return trimmed vector
161138
return(vec[1:trimto])
162139
}
163-
164-
# Function if payoffs, prices and discounting are functions; but uptakes is a vector
165-
dynpv_semicts <- function(uptakes, payoffs, horizon, tzero, prices, discrate){
166-
# Avoid no visible binding note
167-
j <- uj <- pRv <- pv <- NULL
168-
# Trim
169-
uptakes <- trim_vec(uptakes)
170-
# Integrand function
171-
integrand <- function(k, j) {
172-
payoffs(k) * prices(j+k+tzero) * discrate(j+k)
173-
}
174-
# Create a dataset for each combination of time
175-
df <- expand_grid(j=1:length(uptakes)) |>
176-
dplyr::mutate(
177-
uj = uptakes[j],
178-
pRv = stats::integrate(integrand, lower=0, upper=horizon-j, j=j)$value,
179-
pv = uj * pRv
180-
)
181-
class(df) <- c("dynpv", class(df))
182-
return(df)
183-
}
184-
185-
# Function if uptakes, payoffs, prices and discounting are functions
186-
dynpv_fullycts <- function(uptakes, payoffs, horizon, tzero, prices, discrate){
187-
# First integrand function - pRv, to be integrated between k=0 and k=T-j
188-
integrand1 <- function(k, j) {
189-
payoffs(k) * prices(j+k+tzero) * discrate(j+k)
190-
}
191-
# Second integrand function, uj I, to be integrated between j=0 and j=T
192-
integrand2 <- function(j) {
193-
pRv <- stats::integrate(integrand1, lower=0, upper=horizon-j, j=j)$value
194-
uptakes(j) * pRv
195-
}
196-
# Needs to be vectorized before integrating
197-
integrand2 <- Vectorize(integrand2, "j")
198-
# Calculate double integral
199-
df <- stats::integrate(integrand2, lower=0, upper=horizon)
200-
return(df$value)
201-
}

README.Rmd

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Through the [dynpv()](https://msdllcpapers.github.io/dynamicpv/reference/dynpv.h
2929

3030
## Installation
3131

32-
The package is now available on [CRAN](https://cran.r-project.org/web/packages/index.html). Installing from here is simplest, as follows.
32+
The package should shortly be available on [CRAN](https://cran.r-project.org/web/packages/index.html). Installing from here is simplest, once available.
3333

3434
```{r inst_cran}
3535
#| eval: false
@@ -48,7 +48,14 @@ install.packages("devtools")
4848
pak::pak("MSDLLCpapers/dynamicpv")
4949
```
5050

51-
Installing the development version in this way does not include vignettes. Vignettes may be viewed on the [package website](https://msdllcpapers.github.io/dynamicpv/). You can then load the package, alongside other packages you may find helpful.
51+
Note that the above does not install vignettes. Vignettes may be viewed on the [package website](https://msdllcpapers.github.io/dynamicpv/) or by instead running the following.
52+
53+
```{r instal2}
54+
#| eval: false
55+
devtools::install_github("MSDLLCpapers/dynamicpv", build_vignettes=TRUE)
56+
```
57+
58+
You should then load the package, alongside some other packages used here.
5259

5360
```{r instal3}
5461
#| eval: false

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ cost-effectiveness model, such as one computed using the
3636

3737
## Installation
3838

39-
The package is now available on
39+
The package should shortly be available on
4040
[CRAN](https://cran.r-project.org/web/packages/index.html). Installing
41-
from here is simplest, as follows.
41+
from here is simplest, once available.
4242

4343
``` r
4444
# CRAN installation - when available
@@ -56,10 +56,16 @@ install.packages("devtools")
5656
pak::pak("MSDLLCpapers/dynamicpv")
5757
```
5858

59-
Installing the development version in this way does not include
60-
vignettes. Vignettes may be viewed on the [package
61-
website](https://msdllcpapers.github.io/dynamicpv/). You can then load
62-
the package, alongside other packages you may find helpful.
59+
Note that the above does not install vignettes. Vignettes may be viewed
60+
on the [package website](https://msdllcpapers.github.io/dynamicpv/) or
61+
by instead running the following.
62+
63+
``` r
64+
devtools::install_github("MSDLLCpapers/dynamicpv", build_vignettes=TRUE)
65+
```
66+
67+
You should then load the package, alongside some other packages used
68+
here.
6369

6470
``` r
6571
# Load the dynamicpv package

cran-comments.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
## Resubmission
2-
This is a resubmission. In this version I have:
3-
4-
* Extended the description text in DESCRIPTION
5-
* Revised the vignettes
6-
71
## R CMD check results
82

93
0 errors | 0 warnings | 1 note

tests/testthat/test-fullycts.R

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/testthat/test-semicts.R

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)