diff --git a/NEWS.md b/NEWS.md index b18210f..3dd1ca2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,19 @@ +# cohort-modeling-tutorial-intro (development version) + +## 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. See `manuscript/README.md` and 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. + # cohort-modeling-tutorial-intro 0.3.1 (2026-11-10) ## Documentation diff --git a/README.Rmd b/README.Rmd index db90da8..b11caec 100644 --- a/README.Rmd +++ b/README.Rmd @@ -17,6 +17,8 @@ This GitHub repository has the R code for a tutorial on implementing time-indepe Every release of the code is archived in Zenodo: https://doi.org/10.5281/zenodo.5223092 (this DOI always resolves to the latest version). > **Correction (v0.3.0):** Versions up to v0.2.1, and the published article, assigned Simpson's 1/3rd within-cycle correction weights by vector position instead of by time. They used `1/3, 2/3, 4/3, …` instead of `1/3, 4/3, 2/3, …`. v0.3.0 fixes this. With the fix, base-case QALYs are about 0.32 higher per strategy and ICERs change by about 0.4%; the conclusions are unchanged. See [`NEWS.md`](NEWS.md) for details and a before/after table. We thank Lauren N. Steimle and [ambtnhlr](https://github.com/ambtnhlr) for finding and reporting this error (see [Acknowledgements](#acknowledgements)). +> +> **Erratum in the published parameter table:** Table 2 of the article lists the cost of treatment B (`c_trtB`) as $12,000. The correct value is **$13,000**, as stated in the article's text and used in the code, the PSA distribution (gamma(86.2, 150.8), mean $13,000) and the published results. We thank [conallaque](https://github.com/conallaque) for reporting it ([#1](https://github.com/DARTH-git/cohort-modeling-tutorial-intro/issues/1)). ## Quick start @@ -114,6 +116,7 @@ To learn how to implement time-dependent cohort state-transition models (cSTMs) We are grateful to the users who have helped improve this code: - **Lauren N. Steimle** (Georgia Institute of Technology) and **[ambtnhlr](https://github.com/ambtnhlr)** each independently found and reported the indexing error in the Simpson's 1/3rd within-cycle correction (`gen_wcc()`) and proposed a correction. Their reports led to the fix in v0.3.0 ([#2](https://github.com/DARTH-git/cohort-modeling-tutorial-intro/issues/2)). +- **[conallaque](https://github.com/conallaque)** found, while replicating the model independently in Python, that the published parameter table lists the cost of treatment B as $12,000 instead of the $13,000 used in the text, code and results ([#1](https://github.com/DARTH-git/cohort-modeling-tutorial-intro/issues/1)). If you find an error, please [let us know](#reporting-issues-and-contributing). diff --git a/README.md b/README.md index 5f62b6e..8d6b9cc 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,14 @@ the latest version). > for details and a before/after table. We thank Lauren N. Steimle and > [ambtnhlr](https://github.com/ambtnhlr) for finding and reporting this > error (see [Acknowledgements](#acknowledgements)). +> +> **Erratum in the published parameter table:** Table 2 of the article +> lists the cost of treatment B (`c_trtB`) as \$12,000. The correct +> value is **\$13,000**, as stated in the article’s text and used in the +> code, the PSA distribution (gamma(86.2, 150.8), mean \$13,000) and the +> published results. We thank +> [conallaque](https://github.com/conallaque) for reporting it +> ([\#1](https://github.com/DARTH-git/cohort-modeling-tutorial-intro/issues/1)). ## Quick start @@ -188,6 +196,11 @@ We are grateful to the users who have helped improve this code: correction (`gen_wcc()`) and proposed a correction. Their reports led to the fix in v0.3.0 ([\#2](https://github.com/DARTH-git/cohort-modeling-tutorial-intro/issues/2)). +- **[conallaque](https://github.com/conallaque)** found, while + replicating the model independently in Python, that the published + parameter table lists the cost of treatment B as \$12,000 instead of + the \$13,000 used in the text, code and results + ([\#1](https://github.com/DARTH-git/cohort-modeling-tutorial-intro/issues/1)). If you find an error, please [let us know](#reporting-issues-and-contributing). diff --git a/manuscript/README.md b/manuscript/README.md index c6d1d48..0fcb192 100644 --- a/manuscript/README.md +++ b/manuscript/README.md @@ -41,3 +41,23 @@ The error was identified and reported independently by Lauren N. Steimle [ambtnhlr](https://github.com/ambtnhlr) ([#2](https://github.com/DARTH-git/cohort-modeling-tutorial-intro/issues/2)). We thank them both. + +## Known erratum: cost of treatment B in the parameter table + +The parameter table (Table 2) lists the cost of treatment B, `c_trtB`, as +**$12,000**. The correct value is **$13,000**. That is the value stated in the +article's text ("costs $13,000 per year"), used in the code, implied by the +PSA distribution in the same row (gamma(86.2, 150.8), whose mean is +86.2 × 150.8 ≈ $13,000), and used to produce all the published results. A +model rebuilt from the table alone with $12,000 would underestimate the ICER of +strategy B by about 9%. + +The error is only in the table, in `cSTM_Tutorial_Intro.Rmd` and the derived +`.tex` and `.pdf` files. The code in this repository is correct, and a unit +test (`tests/testthat/test-psa-params.R`) now checks that the PSA +distributions are centred on the base-case values. + +This was identified and reported by GitHub user +[conallaque](https://github.com/conallaque) +([#1](https://github.com/DARTH-git/cohort-modeling-tutorial-intro/issues/1)), +who replicated the model independently. We thank them. diff --git a/tests/testthat/test-psa-params.R b/tests/testthat/test-psa-params.R new file mode 100644 index 0000000..80c10a9 --- /dev/null +++ b/tests/testthat/test-psa-params.R @@ -0,0 +1,21 @@ +# The PSA distributions should be centred on the base-case values, so that +# the parameter table, the base-case code and the PSA agree (see issue #1, +# where the published table listed c_trtB as $12,000 instead of $13,000). + +test_that("PSA parameter means match the base-case values", { + df_psa <- generate_psa_params(n_sim = 10000, seed = 071818) + expect_setequal(names(df_psa), + intersect(names(df_psa), names(l_params_base))) + for (par in names(df_psa)) { + # 2% relative tolerance: utilities follow beta distributions whose means + # differ slightly from the base case (e.g., u_H has mean 200/203 vs 1) + expect_equal(mean(df_psa[[par]]), l_params_base[[par]], + tolerance = 0.02, label = paste("mean of", par)) + } +}) + +test_that("cost of treatment B is $13,000 in the base case and the PSA", { + expect_equal(l_params_base$c_trtB, 13000) + # Gamma mean = shape * scale + expect_equal(86.2 * 150.8, 13000, tolerance = 1e-3) +})