Repository navigation
Releases
v0.3.2
Bug fixes
check_sum_of_transition_array()(R/Functions.R) compared the sum of each
cycle's transition probabilities in a transition array with the number of
states using exact equality, so rounding error could make it reject a valid
array. It now uses a numerical tolerance (all.equal()), as in darthtools.
This tutorial only checks transition matrices, so its results are not
affected; the same bug stopped the PSA of the state-residence model in
cohort-modeling-tutorial-timedep
(fixed there in v0.3.0).
Documentation
- Documented an erratum in the published article's parameter table (Table 2),
which lists the cost of treatment B (c_trtB) as $12,000 instead of the
$13,000 stated in the text and used in the code, the PSA and the published
results. The code was already correct. Seemanuscript/README.mdand the
README (closes #1). Reported by @conallaque.
Tests
- Added
tests/testthat/test-psa-params.R, which checks that every PSA
distribution is centred on its base-case value (within 2%), so the base
case and the PSA cannot drift apart. - Added
tests/testthat/test-transition-checks.Rfor the transition matrix
and array checks.
v0.3.1
Documentation
darthtoolsv0.4.1 fixes the samegen_wcc()indexing error
(DARTH-git/darthtools#16).
The README and code comments now point to it. The tutorial keeps its own
copy ofgen_wcc()inR/Functions.R, so it still runs without
darthtools.- Corrected the description of the old weights in NEWS.md and in the
gen_wcc()documentation: they summed to n - 2/3 for an even number of
cycles and to n - 1/3 for an odd number (such as the tutorial's 75), not
always to n - 2/3. - Added ORCIDs for Fernando Alarid-Escudero and Alan Yang to
CITATION.cff
andDESCRIPTION.
v0.3.0
This release fixes a bug in the Simpson's 1/3rd within-cycle correction (WCC).
It changes the numerical results reported in the published article, but
not its conclusions.
Bug fixes
-
gen_wcc(method = "Simpson1/3")(R/Functions.R) assigned the 4/3 and 2/3
weights by position in the 1-based R vector instead of by time
t = 0, 1, ..., n. It returned1/3, 2/3, 4/3, 2/3, ..., 1/3instead of
1/3, 4/3, 2/3, 4/3, ..., 1/3, so the weights summed to n - 2/3 instead
of n. For example,gen_wcc(4)integrated f(t) = 1 over [0, 4] as 3.33
instead of 4. Weights are now indexed by time (closes #2).The same error is in the WCC description, the equation and the
within-cycle-vectorcode chunk of the published manuscript. The files in
manuscript/are kept unchanged as the archival source of the article (see
manuscript/README.md).Effect on the base case of the time-independent Sick-Sicker model
(analysis/cSTM_time_indep.R, 75 annual cycles, 3% discount):Strategy QALYs v0.2.1 QALYs v0.3.0 Costs v0.2.1 Costs v0.3.0 ICER v0.2.1 ICER v0.3.0 Standard of care 20.71 21.03 $151,580 $152,282 -- -- Strategy B 22.18 22.50 $259,100 $260,222 $72,988 $73,279 Strategy AB 23.14 23.46 $378,875 $380,378 $125,764 $125,302 Strategy A 21.50 21.83 $284,805 $285,889 Dominated Dominated QALYs increase by about 0.32 per strategy and ICERs change by about 0.4%.
The efficient frontier and the dominance of Strategy A are unchanged. -
The PSA model wrapper (
calculate_ce_out()in
R/Functions_cSTM_time_indep.R) now uses the corrected localgen_wcc().
It used to calldarthtools::gen_wcc(), which has the same bug in
darthtools <= 0.4.0. The deterministic and probabilistic analyses now use
the same WCC, and the repository no longer needsdarthtools. -
calculate_ce_out()had the discount rates swapped: costs were discounted
withd_eand QALYs withd_c. This had no effect on the results because
both rates are 3%, but it would have mattered for differential discounting. -
In
analysis/cSTM_time_indep.R, the state costs under Strategy A
(v_c_strA) were not scaled bycycle_length, unlike every other reward
vector. This had no effect with annual cycles but would have mattered with
monthly cycles.
Changes in behaviour
gen_wcc(method = "Simpson1/3")now supports an odd number of cycles, like
the tutorial's 75 cycles. Simpson's 1/3rd rule needs an even number of
intervals, so for oddn_cyclesthe composite 1/3 rule is applied over the
first n - 3 cycles and Simpson's 3/8 rule over the last three. Both cases
integrate polynomials up to degree three exactly, and the weights always
sum ton_cycles.gen_wcc()validates its input. It now errors whenn_cyclesis not a
single positive integer (it used to truncate, e.g., 7.5 to 7) and when
n_cycles = 1is used with Simpson's rule.
Infrastructure and reproducibility
- Added unit tests (
tests/testthat/) forgen_wcc(): exact weights, exact
integration of polynomials of degree 0-3 for odd and even n, and input
validation. Added a regression test for the base-case CEA. Run them with
testthat::test_dir("tests/testthat"). - Added a GitHub Actions workflow (
.github/workflows/check.yaml). It runs the
tests and the full tutorial analysis on Ubuntu and macOS for every push and
pull request. - Added
renv(renv.lock) to pin package versions. Runrenv::restore()to
reproduce the computational environment. - Added a
DESCRIPTIONfile that records the project version and
dependencies (the repository is not an installable package). - Added
CITATION.cffwith all authors and the preferred citation (the MDM
article). This enables GitHub's "Cite this repository" button and complete
Zenodo metadata. - Added this
NEWS.mdchangelog. - Replaced deprecated
ggplot2arguments (size->linewidthin
geom_line(),..density..->after_stat(density)). - Removed a stray, unnamed copy of
rate_to_prob()fromR/Functions.R.
Documentation
- Rewrote the
gen_wcc()documentation to describe the weights by time
("entries at odd times t = 1, 3, ... get 4/3") and to document the odd-n
extension. - Updated and expanded the README: a corrections notice, quick start with
renv, repository structure, testing, how to report issues, and fixed
typos and citation details (including the Zenodo DOIs). - Added
manuscript/README.mdexplaining how the archival manuscript sources
differ from the corrected code.
Acknowledgements
This bug was found by two attentive users of the tutorial, and we are very
grateful to both:
- Lauren N. Steimle (H. Milton Stewart School of Industrial and Systems
Engineering, Georgia Institute of Technology) found the indexing error while
preparing lecture notes on within-cycle corrections for her graduate course.
She reported it by email in January 2025, with a proposed correction. - @ambtnhlr independently reported the same
error in #2. The report included a reproducible example showing that the
weights did not integrate a constant correctly, a time-indexed fix, a
suggested rewording of the documentation, and the observation that 75
cycles is an odd number of intervals for Simpson's 1/3rd rule.
Their careful reports made this release possible.
Second Zenodo release
Update README Update reference to arxiv paper