Skip to content

Commit

Permalink
Edits in preparation for CRAN release
Browse files Browse the repository at this point in the history
  • Loading branch information
chjackson committed May 23, 2023
1 parent ad55223 commit ad8c609
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 27 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ inst/Chemotherapy_Book/.git
^_pkgdown2\.yml$
git_notes.md
coding_style.md
^.*\.RData
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Package: voi
Title: Expected Value of Information
Version: 0.9
Version: 1.0
Date: 2023-05-23
Authors@R:
c(person(given = "Christopher", family = "Jackson",role = c("aut", "cre"),email = "chris.jackson@mrc-bsu.cam.ac.uk"),
person(given = "Anna", family = "Heath", role = c("aut"), email = "anna.heath@sickkids.ca"),
Expand All @@ -15,7 +16,7 @@ Encoding: UTF-8
LazyData: true
Depends: R (>= 2.10)
VignetteBuilder: knitr
Imports: mgcv, earth, mvtnorm, progress, dbarts, posterior, ggplot2, gridExtra
Imports: mgcv, earth, mvtnorm, progress, dbarts, posterior, ggplot2, gridExtra, Matrix
Suggests: testthat, BCEA, INLA, splancs, knitr, rmarkdown, rjags, truncnorm, scales, dplyr, heemod
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE)
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export(evsivar)
export(import_heemod_inputs)
export(import_heemod_outputs)
export(pop_voi)
importFrom(Matrix,nearPD)
importFrom(ggplot2,aes)
importFrom(ggplot2,geom_histogram)
importFrom(ggplot2,geom_linerange)
Expand Down
4 changes: 2 additions & 2 deletions R/evppi.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
##'
##' \code{"gp"} for a Gaussian process regression, as described by Strong et al.
##' (2014) and implemented in the \pkg{SAVI} package
##' (\url{http://savi.shef.ac.uk/SAVI/}). This is the default method for calculating the EVPPI
##' (\url{https://savi.shef.ac.uk/SAVI/}). This is the default method for calculating the EVPPI
##' of more than 4 parameters.
##'
##' \code{"inla"} for an INLA/SPDE Gaussian process regression method, from
Expand Down Expand Up @@ -128,7 +128,7 @@
##' basis. If there are four or more parameters of interest, then the
##' additional argument \code{k=4} is supplied to \code{te()}, specifying a
##' four-dimensional basis, which is currently the default in the SAVI package
##' (\url{http://savi.shef.ac.uk/SAVI/}).
##' (\url{https://savi.shef.ac.uk/SAVI/}).
##'
##' If there are spaces in the variable names in \code{inputs}, then these should
##' be converted to underscores before forming an explicit \code{gam_formula}.
Expand Down
1 change: 1 addition & 0 deletions R/voi-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@
##' @importFrom stats formula as.formula dist dnorm formula optim sd var rbeta rbinom rlnorm rnorm quantile dbinom coef vcov predict AIC cov lm fitted reorder IQR residuals update pnorm
##' @importFrom utils select.list combn
##' @importFrom progress progress_bar
##' @importFrom Matrix nearPD
##'
NULL
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

- Expected Value of Sample Information

* A project of the [ConVOI Group: the Collaborative Network for Value of Information](http://convoi-group.org)
* A project of the [ConVOI Group: the Collaborative Network for Value of Information](https://www.convoi-group.org/)


## Comparison with other packages

`voi` is pure "command-based" R, with no web interface like [SAVI](http://savi.shef.ac.uk).
`voi` is pure "command-based" R, with no web interface like [SAVI](https://savi.shef.ac.uk/).

* The R commands in `voi` are clean and consistent. They all have the same basic interface, so you can switch between computational methods easily.
* The R commands in `voi` are clean and consistent: they all have the same basic interface, so you can switch between computational methods easily.

* Outputs are all in "tidy" data frames for consistency, and to facilitate post-processing and plotting with modern tools such as [ggplot2](http://ggplot2.tidyverse.org).
* Outputs are all in "tidy" data frames for consistency, and to facilitate post-processing and plotting with modern tools such as [ggplot2](https://ggplot2.tidyverse.org/).

#### EVPPI computation

* `voi` includes all the [EVPPI computation](https://chjackson.github.io/voi/articles/voi.html#evppi) methods that are in [SAVI](http://savi.shef.ac.uk) (GAM and Gaussian process regression), and includes the INLA method from [BCEA](https://cran.r-project.org/package=BCEA).
* `voi` includes all the [EVPPI computation](https://chjackson.github.io/voi/articles/voi.html#evppi) methods that are in [SAVI](https://savi.shef.ac.uk/) (GAM and Gaussian process regression), and includes the INLA method from [BCEA](https://cran.r-project.org/package=BCEA).

* Some other nonparametric regression methods ([`"earth"`](https://chjackson.github.io/voi/articles/voi.html#earth), [`"bart"`](https://chjackson.github.io/voi/articles/voi.html#bart)) are included in `voi`, which may improve efficiency for multiparameter EVPPI computation problems with large numbers of parameters.

Expand All @@ -29,7 +29,7 @@

#### In summary

* `voi` will not benefit SAVI users that just need single-parameter EVPPI, or users that want a web interface.
* `voi` will not benefit you if you want a web interface, or if you just need single-parameter EVPPI and are happy with SAVI/BCEA.

* `voi` will benefit you if you want to calculate EVSI, or multiparameter EVPPI with large numbers of parameters.

Expand All @@ -53,7 +53,7 @@ remotes::install_github("chjackson/voi")

## Source code

[Github repository](http://github.com/chjackson/voi)
[Github repository](https://github.com/chjackson/voi)


<!-- badges: start -->
Expand Down
4 changes: 2 additions & 2 deletions man/evppi.Rd

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

4 changes: 2 additions & 2 deletions man/evppivar.Rd

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

24 changes: 12 additions & 12 deletions vignettes/voi.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This document gives a simple overview of how the `voi` package is used to calcul

The example model is a model used for _decision making_, which has been the most common application of VoI, e.g. in health economic evaluations.

A later section describes the use of VoI methods for a model that is used for _estimation_ of uncertain quantities, rather than for explicit decision-making. For more information about the theory behind this, see [Jackson et al. 2019](https://doi.org/10.1080/01621459.2018.1562932) and [Jackson et al. 2021](https://www.degruyter.com/document/doi/10.1515/em-2021-0012/html).
A later section describes the use of VoI methods for a model that is used for _estimation_ of uncertain quantities, rather than for explicit decision-making. For more information about the theory behind this, see [Jackson et al. 2019](https://doi.org/10.1080/01621459.2018.1562932) and [Jackson et al. 2021](https://doi.org/10.1515/em-2021-0012).

## Simple example model

Expand Down Expand Up @@ -160,7 +160,7 @@ The EVPPI is defined as the expected net benefit given perfect knowledge of $\ph

The function `evppi` can be used to compute this.

There are a variety of alternative computational methods implemented in this function. The default methods are based on nonparametric regression, and come from [Strong et al. (2013)](https://doi.org/10.1177/0272989X13505910). If there are four or fewer parameters, then a generalized additive model is used. With five or more, then Gaussian process regression is used.
There are a variety of alternative computational methods implemented in this function. The default methods are based on nonparametric regression, and come from [Strong et al. (2013)](https://doi.org/10.1177/0272989X13505910). If there are four or fewer parameters, then a generalized additive model is used (the default spline model in `gam` from the `mgcv` package). With five or more, then Gaussian process regression is used.


### Invoking the `evppi` function.
Expand Down Expand Up @@ -203,14 +203,14 @@ evppi(outputs_nb, inputs, pars="p1", method="gp", nsim=1000)
```

#### Multivariate adaptive regression splines {#earth}
This is a variant of generalized additive models based on linear splines, which uses a package called [earth](https://CRAN.R-project.org/package=earth).
This is a variant of generalized additive models based on linear splines, which uses a package called [earth](https://CRAN.R-project.org/package=earth).
```{r}
evppi(outputs_nb, inputs, pars="p1", method="earth")
```
While the merits of this method for EVPPI computation have not been systematically investigated, I have found this to be generally faster than comparable `mgcv` spline models for similar levels of accuracy and around 5 or fewer parameters.

#### INLA method
(from [Heath et al.](https://onlinelibrary.wiley.com/doi/full/10.1002/sim.6983), [Baio et al.](https://link.springer.com/content/pdf/10.1007/978-3-319-55718-2.pdf) ). This needs the following extra packages to be installed, using the following commands.
(from [Heath et al.](https://doi.org/10.1002/sim.6983), [Baio et al.](https://doi.org/10.1007/978-3-319-55718-2) ). This needs the following extra packages to be installed, using the following commands.

```{r,eval=FALSE}
install.packages('INLA', repos='https://inla.r-inla-download.org/R/stable')
Expand All @@ -221,7 +221,7 @@ It is only applicable to calculating the multiparameter EVPPI for 2 or more para

In this toy example it is overkill, since the two-parameter EVPPI is simply the EVPI, and the default method needs an esoteric tweak (`pfc_struc`) to work.

However it has been found to be more efficient than the Gaussian process method in many other situations. See [Heath et al.](https://onlinelibrary.wiley.com/doi/full/10.1002/sim.6983), [Baio et al.](https://link.springer.com/content/pdf/10.1007/978-3-319-55718-2.pdf) for more details about implementing and tuning this method.
However it has been found to be more efficient than the Gaussian process method in many other situations. See [Heath et al.](https://doi.org/10.1002/sim.6983), [Baio et al.](https://doi.org/10.1007/978-3-319-55718-2) for more details about implementing and tuning this method.

```{r,eval=FALSE}
evppi(outputs_nb, inputs, pars=c("p1","p2"), method="inla", pfc_struc="iso")
Expand All @@ -240,7 +240,7 @@ evppi(chemo_nb, chemo_pars, pars=colnames(chemo_pars), method="bart")
evpi(chemo_nb)
```

The BART estimation is being performed using the `bart()` function from the [dbarts](https://cran.r-project.org/web/packages/dbarts/index.html) package, and in this case the function's default settings are used.
The BART estimation is being performed using the `bart()` function from the [dbarts](https://CRAN.R-project.org/package=dbarts) package, and in this case the function's default settings are used.

While the BART method has not been investigated systematically as a way of estimating EVPPI, these are promising results.

Expand Down Expand Up @@ -275,7 +275,7 @@ supplied in the package for academic interest, but for single-parameter EVPPI we
found it to be sufficiently reliable to use the default GAM method, which requires less tuning than
these methods.

The method of [Strong and Oakley](https://journals.sagepub.com/doi/full/10.1177/0272989X12465123):
The method of [Strong and Oakley](https://doi.org/10.1177/0272989X12465123):

```{r}
evppi(outputs_nb, inputs, pars="p1", n.blocks=20, method="so")
Expand Down Expand Up @@ -459,9 +459,9 @@ evsi(outputs_nb, inputs, study = "normal_known", n=100, pars = "p1", method="is"

### Moment matching method

The momemt matching method from [Heath et al.](https://journals.sagepub.com/doi/10.1177/0272989X17738515) is available as `evsi(..., method="mm")`. This includes the extension of this method to efficiently estimate the EVSI for the same design but with many different sample sizes (from [Heath et al](https://doi.org/10.1177/0272989X19837983)).
The momemt matching method from [Heath et al.](https://doi.org/10.1177/0272989X17738515) is available as `evsi(..., method="mm")`. This includes the extension of this method to efficiently estimate the EVSI for the same design but with many different sample sizes (from [Heath et al](https://doi.org/10.1177/0272989X19837983)).

Roughly, this method works as follows (see [Heath et al.](https://journals.sagepub.com/doi/10.1177/0272989X17738515) for full details)
Roughly, this method works as follows (see [Heath et al.](https://doi.org/10.1177/0272989X17738515) for full details)

* a small set of values $\theta_q: q = 1,\ldots, Q$ are simulated for the decision model parameters $\theta$ (typically $Q<50$ is sufficient).

Expand Down Expand Up @@ -642,8 +642,8 @@ var(p2)

A more interesting quantity is the EVPPI for a parameter. It describes the expected reduction in variance given perfect knowledge of a particular parameter. In this example, we compute the EVPPI for $p_1$ and $\beta$, respectively, defined as

$$EVPPI[p_1] = var(p_2) - E(var(p_2| p_1)$$
$$EVPPI[\beta] = var(p_2) - E(var(p_2 | \beta)$$
$$EVPPI[p_1] = var(p_2) - E(var(p_2| p_1))$$
$$EVPPI[\beta] = var(p_2) - E(var(p_2 | \beta))$$

These can be computed using nonparametric regression, as described in [Jackson et al. 2019](https://doi.org/10.1080/01621459.2018.1562932). This is implemented in the function `evppivar` in the `voi` package.

Expand All @@ -663,7 +663,7 @@ sqrt(var(p2) - evppi_beta$evppi)
sqrt(var(p2) - evppi_p1$evppi)
```

Hence we would expect to reduce the SD of $p_1$ to around 2/3 of its original value by learning $p_1$ or $\beta$.
Hence we would expect to reduce the SD of $p_2$ to around 2/3 of its original value by learning $p_1$ or $\beta$.


### How regression-based EVPPI estimation works
Expand Down

0 comments on commit ad8c609

Please sign in to comment.