Repository navigation
Conversation
- bcea_to_psa(): turns BCEA::bcea() output into a dampack psa object (costs, effects, and intervention names; optional parameters and currency), so dampack's analyses and plots can be used on it. - psa_to_bcea(): the reverse, via BCEA::bcea(); ref_str names the reference strategy, and ... is passed on (e.g., Kmax). - BCEA is a suggested package, needed only for psa_to_bcea() (rlang::check_installed()). Examples run only when BCEA is installed. - Tests: conversion with a BCEA-shaped object (no BCEA needed), input errors, and with BCEA installed a round trip on BCEA's Vaccine data and an independent check that calc_evpi() equals BCEA's EVPI (to 1e-8). Closes #204
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
Collaborator
Author
|
Hi @krijkamp, this PR adds the BCEA conversion you suggested in #204. Fernando asked me (Claude, working in his session) to send a short guide so it's quick to review. Try itinstall.packages("BCEA")
remotes::install_github("DARTH-git/dampack", ref = "204-bcea-conversion")
library(dampack)
data(Vaccine, package = "BCEA")
m <- BCEA::bcea(eff, cost, ref = 2, interventions = treats, Kmax = 50000)
psa_vaccine <- bcea_to_psa(m, currency = "£") # BCEA -> dampack
plot(psa_vaccine)
plot(ceac(psa_vaccine, wtp = seq(0, 50000, by = 5000)))
calc_evpi(psa_vaccine, wtp = seq(0, 50000, by = 5000))
m2 <- psa_to_bcea(psa_vaccine, ref_str = "Vaccination", Kmax = 50000) # dampack -> BCEA
summary(m2)What to look at
How to leave your review
A plain comment at the bottom of this page also works. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #204. This was Eline's suggestion, so I've asked her to review.
What's new
bcea_to_psa(bcea, currency = "$", parameters = NULL): builds apsaobject from abceaobject's costs, effects and intervention names. BCEA objects don't store parameter values, so they can be passed in to use EVPPI or OWSA.psa_to_bcea(psa, ref_str = NULL, ...): callsBCEA::bcea().ref_strnames the reference strategy (it defaults to the first), and...is passed on, e.g.Kmax.psa_to_bcea(), which tells the user to install it if it's missing. The examples run only when BCEA is installed.Tests
bceaobject or is incomplete.Vaccinedata, which returns the same effects, costs and reference.calc_evpi()equals BCEA's own EVPI to within 1e-8 at several willingness-to-pay values. That's an external validation of dampack's EVPI, possibly worth a sentence in the JOSS paper.I ran the BCEA tests against BCEA 2.4.83, installed in a separate library. CI doesn't install BCEA, so it runs the BCEA-free tests and skips the rest.
Verification
pkgdown::check_pkgdown()is clean.R CMD check --as-cran: 0 errors, 0 warnings, 1 NOTE (the development version number).main.