Skip to content

Commit

Permalink
Merge pull request #54 from n8thangreen/dev
Browse files Browse the repository at this point in the history
refactored evppi and fixed some small bugs
  • Loading branch information
giabaio authored Nov 10, 2023
2 parents 62c0bb6 + b367755 commit 8eee198
Show file tree
Hide file tree
Showing 312 changed files with 9,975 additions and 3,513 deletions.
1 change: 0 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
^_pkgdown\.yml$
^docs$
^pkgdown$
^vignettes$
^\.httr-oauth$
^CONDUCT\.md$
^man-roxygen$
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/check-standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- uses: r-lib/actions/setup-r@v2
with:
extra-repositories: 'https://inla.r-inla-download.org/R/stable'
extra-repositories: 'https://inla.r-inla-download.org/R/testing'
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true
Expand All @@ -43,7 +43,7 @@ jobs:

- name: Add inla repo
run: |
cat('options(repos = c(INLA = "https://inla.r-inla-download.org/R/stable/", getOption("repos")))', file = "~/.Rprofile", append = TRUE)
cat('options(repos = c(INLA = "https://inla.r-inla-download.org/R/testing/", getOption("repos")))', file = "~/.Rprofile", append = TRUE)
# cat("\noptions(tinytex.verbose = TRUE)\n", file = "~/.Rprofile", append = TRUE)
shell: Rscript {0}

Expand All @@ -53,7 +53,7 @@ jobs:
shell: Rscript {0}

# - name: Install JAGS
# run: |
# run: |
# sudo apt-get update -y
# sudo apt-get install -y jags

Expand All @@ -67,15 +67,13 @@ jobs:

- name: Install jags (macOS-latest)
if: runner.os == 'macOS'
run : |
rm '/usr/local/bin/gfortran'
brew install jags
run : brew install jags

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages:
any::rcmdcheck, local::.
needs: check
dependencies: '"all"'
extra-packages: |
rcmdcheck
- uses: r-lib/actions/check-r-package@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion BCEA.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ LaTeX: pdfLaTeX
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
PackageRoxygenize: rd,collate,namespace,vignette
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 2.4.2
Date: 2022-08-23 11:44:30 UTC
SHA: f0469ce213fba001efa2707da7fa79289b337105
Version: 2.4.4
Date: 2023-06-05 12:52:55 UTC
SHA: 770d3d2d910eca75ebaaccf4c290c20e4668a95a
25 changes: 15 additions & 10 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Package: BCEA
Type: Package
Title: Bayesian Cost Effectiveness Analysis
Version: 2.4.2.9000
Version: 2.4.5
Authors@R: c(
person("Gianluca", "Baio",
email = "gianluca@stats.ucl.ac.uk",
role = c("aut", "cre"),
email = "g.baio@ucl.ac.uk",
role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0003-4314-2570")),
person("Andrea", "Berardi",
email = "a.berardi@ucl.ac.uk",
Expand All @@ -23,36 +23,38 @@ Imports:
cli (>= 3.3.0),
dplyr,
ggplot2,
gridExtra,
graphics,
gridExtra,
MASS,
Matrix,
MCMCvis,
purrr,
Rdpack,
reshape2,
rlang,
scales
scales,
voi
Depends:
R (>= 3.5.0)
Suggests:
coda,
grid,
INLA,
knitr,
markdown,
MCMCvis,
mgcv,
plotly,
plotrix,
RColorBrewer,
rjags,
rmarkdown,
rstan,
RColorBrewer,
splancs,
testthat (>= 2.1.0),
vdiffr,
withr
RdMacros: Rdpack
Additional_repositories: https://inla.r-inla-download.org/R/stable/
VignetteBuilder: knitr
Additional_repositories: https://inla.r-inla-download.org/R/testing/
Description: Produces an economic evaluation of a sample of suitable variables of
cost and effectiveness / utility for two or more interventions,
e.g. from a Bayesian model in the form of MCMC simulations.
Expand All @@ -64,6 +66,9 @@ URL: https://gianluca.statistica.it/software/bcea/,
https://gianluca.statistica.it/,
https://github.com/giabaio/BCEA/
NeedsCompilation: no
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3.9000
Encoding: UTF-8
BugReports: https://github.com/n8thangreen/BCEA/issues/
Remotes:
chjackson/voi
LazyData: false
12 changes: 5 additions & 7 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ export(validate_bcea)
import(dplyr)
import(ggplot2)
import(grid)
import(purrr)
import(reshape2)
importFrom(MASS,kde2d)
importFrom(MCMCvis,MCMCchains)
importFrom(Matrix,Matrix)
importFrom(Matrix,expm)
importFrom(Rdpack,reprompt)
Expand All @@ -109,7 +109,6 @@ importFrom(dplyr,slice)
importFrom(grDevices,colors)
importFrom(grDevices,colours)
importFrom(grDevices,dev.new)
importFrom(grDevices,dev.off)
importFrom(grDevices,devAskNewPage)
importFrom(grDevices,grey.colors)
importFrom(grDevices,pdf.options)
Expand All @@ -131,7 +130,10 @@ importFrom(graphics,text)
importFrom(grid,unit)
importFrom(gridExtra,grid.arrange)
importFrom(purrr,keep)
importFrom(purrr,list_cbind)
importFrom(purrr,map)
importFrom(purrr,map_int)
importFrom(purrr,map_lgl)
importFrom(purrr,pluck)
importFrom(reshape2,melt)
importFrom(rlang,.data)
Expand All @@ -140,10 +142,7 @@ importFrom(scales,label_dollar)
importFrom(stats,as.formula)
importFrom(stats,cov)
importFrom(stats,density)
importFrom(stats,dist)
importFrom(stats,dnorm)
importFrom(stats,lm)
importFrom(stats,optim)
importFrom(stats,qnorm)
importFrom(stats,qqline)
importFrom(stats,qqnorm)
Expand All @@ -153,9 +152,8 @@ importFrom(stats,rnorm)
importFrom(stats,runif)
importFrom(stats,sd)
importFrom(stats,setNames)
importFrom(stats,update)
importFrom(utils,methods)
importFrom(utils,modifyList)
importFrom(utils,select.list)
importFrom(utils,str)
importFrom(utils,tail)
importFrom(voi,evppi)
55 changes: 46 additions & 9 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,47 @@

# BCEA 2.4.2.9000
# BCEA 2.4.5

_October 2023_

Moved internal EVPPI calculation out of `BCEA` and now uses `voi` package instead.
Refactoring but retaining same interface and functionality.

* `evppi()` tested against all use cases in BCEA book (1c1457d2)
* Select parameters by position (as well as name) in new `evppi()` (f2e4d005)
* Use single parameter case only like `voi` package for methods `sal` and `so` (#140)
* New `evppi()` matching output of old `evppi()` (1e2c5e7)
* Latest development version of `voi` needed when we use `check = TRUE` in `voi::evppi()` in order to access fitting data (6e436b5, 94f5fc5)
* No longer require `INLA` package to be available inside of `BCEA` so can remove direct dependency. This helps with passing CRAN checks and GitHub Actions ()

# BCEA 2.4.4
_June 2023_

* Patch to fix a CRAN checks error. Suggested package `MCMCvis` wasn't used conditionally in unit test. Moved to Required packages in `DESCRIPTION`.

# BCEA 2.4.3
_May 2023_

## Bug fixes

* Consistent colours across plots for each intervention for grid of plots in `plot.bcea()` (cf1ee43)
* `make.report()` change variable name (f940f2e)
* Fixed issue with summary table where names of interventions in the wrong order (6a006e3)
* `summary.bcea()` now only prints results for chosen comparisons and not always all of them. `kstar` and `best` in `bcea()` object were not updated with subset of interventions (#125)

## Refactoring

* `withr::with_par()` used in plotting function `plot.bcea()` to only temporarily change graphics parameters. (725c536)
* Using `@md` and markdown syntax in function documentation
* Update `psa.struct()` to add the absolute value in the formula to compute the weights (1cea278)
* Use `dplyr` piping new syntax from `.data$*` to simply using speech marks `"*"` (2b280ad)

## Miscellaneous

* Template added for GitHub Issues (0ea59fa)


# BCEA 2.4.2
August 2022
_August 2022_

## Bug fixes

Expand All @@ -24,15 +62,14 @@ August 2022
## New features

* Can now specify what order the interventions labels are in the legend for ce plane (and contour plots) for base R and ggplot2 i.e. reference first or second with optional `ref_first` argument (cc38f07)
* Can specify currency for axes in `ce-plane.plot` and `ceac.plot` `ggplot2` versions (6808aa6)
* Argument added to `ceplane.plot` of `icer_annot` to annotate each of the ICER points with the text label of the intervention name. Only for `ggplot2` at the moment. (a7b4beb)
* Can specify currency for axes in `ceplane.plot()` and `ceac.plot()` `ggplot2` versions (6808aa6)
* Argument added to `ceplane.plot()` of `icer_annot` to annotate each of the ICER points with the text label of the intervention name. Only for `ggplot2` at the moment. (a7b4beb)
* Added `pos` argument to `contour2()` so that its consistent with `contour()` and `ceplane.plot()`. (50f8f8b)
* Allow passing `ref` argument by name as well as index in `bcea()`. (9eab459)



# BCEA 2.4.1.2
April 2022
_April 2022_

## Bug fixes

Expand Down Expand Up @@ -64,7 +101,7 @@ April 2022


# BCEA 2.4.1.1
Oct 2021
_Oct 2021_

## Major refactoring

Expand Down Expand Up @@ -156,9 +193,9 @@ Oct 2015
* New function for EVPPI using SPDE-INLA
* Modifications to the EVPPI functions
* Documentation updated
* Allows `xlim` & `ylim` in the `ceplane.plot`, `contour` and `contour2` functions
* Allows `xlim` & `ylim` in the `ceplane.plot()`, `contour()` and `contour2()` functions
* It is now possible to run `bcea` for a scalar wtp
* Old `evppi` function and method has been renamed `evppi0`, which means there's also a new `plot.evppi0` method
* Old `evppi()` function and method has been renamed `evppi0`, which means there's also a new `plot.evppi0` method

# BCEA 2.1-0
13 Jan 2015
Expand Down
58 changes: 21 additions & 37 deletions R/BCEA-package.R
Original file line number Diff line number Diff line change
@@ -1,39 +1,23 @@
#------------------------------------------------------------------------------#
#
# ___ ___ ___
# _____ / /\ / /\ / /\
# / /::\ / /:/ / /:/_ / /::\
# / /:/\:\ / /:/ / /:/ /\ / /:/\:\
# / /:/~/::\ / /:/ ___ / /:/ /:/_ / /:/~/::\
# /__/:/ /:/\:| /__/:/ / /\ /__/:/ /:/ /\ /__/:/ /:/\:\
# \ \:\/:/~/:/ \ \:\ / /:/ \ \:\/:/ /:/ \ \:\/:/__\/
# \ \::/ /:/ \ \:\ /:/ \ \::/ /:/ \ \::/
# \ \:\/:/ \ \:\/:/ \ \:\/:/ \ \:\
# \ \::/ \ \::/ \ \::/ \ \:\
# \__\/ \__\/ \__\/ \__\/
#
#
#------------------------------------------------------------------------------#

#' BCEA: A package for Bayesian Cost-Effectiveness Analysis
#'
#' A package to post-process the results of a Bayesian health economic model
#' and produce standardised output for the analysis of the results.
#'
#' \tabular{ll}{ Package: \tab BCEA\cr
#' Type: \tab Package\cr
#' Version: \tab 2.4.2\cr
#' Date: \tab 2022-09-03\cr
#' License: \tab GPL2 \cr
#' LazyLoad: \tab Yes\cr }
#'
#' BCEA produces a health economic evaluation given a random sample of
#' suitable variables of costs and clinical benefits for two or more
#' interventions, e.g. using results of a Bayesian model (possibly based on
#' MCMC) in the form of simulations from the posterior distributions.
#' Compares one of the interventions (the "reference") to the others
#' ("comparators"). Produces many summaries and plots to analyse the results.
#'
#' @aliases BCEA-package BCEA
#'
#' @author Gianluca Baio, Andrea Berardi, Anna Heath, Nathan Green
#'
#' @references
#' \insertRef{Baio2011}{BCEA}
#'
#' \insertRef{Baio2013}{BCEA}
#'
#' \insertRef{Baio2017}{BCEA}
#'
#' @keywords package
#'
#' @docType package
#' @name BCEA-package
#'
#' @import dplyr ggplot2 purrr reshape2
#' @importFrom Rdpack reprompt
#' @keywords internal
"_PACKAGE"

## usethis namespace: start
## usethis namespace: end
NULL
8 changes: 4 additions & 4 deletions R/CEriskav_plot_graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ CEriskav_plot_ggplot <- function(he, pos_legend) {
eib_dat <-
melt(he$eibr[, default_comp, , drop = FALSE],
value.name = "eibr") %>%
rename(k = .data$Var1,
r = .data$Var3) %>%
rename(k = "Var1",
r = "Var3") %>%
mutate(r = as.factor(.data$r))

eibr_plot <-
Expand Down Expand Up @@ -122,8 +122,8 @@ CEriskav_plot_ggplot <- function(he, pos_legend) {
evi_dat <-
melt(he$evir,
value.name = "evir") %>%
rename(r = .data$Var2,
k = .data$Var1) %>%
rename(r = "Var2",
k = "Var1") %>%
mutate(r = as.factor(.data$r))

evir_plot <-
Expand Down
6 changes: 6 additions & 0 deletions R/CreateInputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
createInputs.default <- function(inputs,
print_is_linear_comb = TRUE) {

# remove NA columns
if (sum(is.na(inputs)) > 0) {
inputs <- inputs[ , colSums(is.na(inputs)) == 0]
message("Dropped any columns containing NAs")
}

if (!is.logical(print_is_linear_comb))
stop("print_is_linear_comb must be logical.", call. = FALSE)

Expand Down
Loading

0 comments on commit 8eee198

Please sign in to comment.