You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just noticed what looks like an indexing issue in gen_wcc(method = "Simpson1/3"). I'm not sure whether it has been fixed somewhere already, so apologies if this is a duplicate.
The weights come out as 1/3, 2/3, 4/3, 2/3, …, 1/3 instead of 1/3, 4/3, 2/3, 4/3, …, 1/3, so they sum to n − 2/3 rather than n:
w <- gen_wcc(4, "Simpson1/3")
w # 1/3 2/3 4/3 2/3 1/3
sum(w) # 3.33; integral of 1 over [0, 4] should be 4
sum(w * (0:4)^2) # 17.33; should be 21.33
I think it's because v_cycles holds 1-based positions, so position 2 is t = 1, which should get 4/3. Indexing by time seems to fix it:
The documentation ("odd and even entries with 4/3 and 2/3") matches the code, so it may be worth rewording too, e.g. "entries at odd times (t = 1, 3, …) get 4/3", since odd positions in a 1-based R vector are even times.
In the time-independent Sick-Sicker tutorial, this lowers QALYs by about 0.33 per strategy, though ICERs only move about 0.2%. (With 75 cycles the number of intervals is also odd, so Simpson's 1/3 rule doesn't strictly apply there.)
If this is incorrect, I apologize, kindly ignore. Have a great day, thanks for the great tutorial!
Thank you so much for this careful report, and you're right. gen_wcc()
assigned Simpson's weights by 1-based vector position instead of by time, so
the vector was 1/3, 2/3, 4/3, … instead of 1/3, 4/3, 2/3, …. Lauren Steimle
independently reported the same issue by email, and we've credited you both
in NEWS.md.
Since the tutorial uses 75 (odd) cycles, as you pointed out, the last
three cycles now use Simpson's 3/8 rule. Polynomials up to degree three are
still integrated exactly, and the weights sum to n.
The PSA wrapper now uses the same corrected function instead of darthtools::gen_wcc(), which has the same bug. A darthtools fix is in
progress.
We reworded the documentation in the way you suggested, and added unit
tests, including your example.
In the base case, QALYs increase by about 0.32 per strategy and ICERs change
by about 0.4%. The frontier and dominance results don't change. The before/after
table is in NEWS.md, and manuscript/README.md records the erratum for the
published article's code.
Thanks again for taking the time to dig into this!
Activity
feralaes commentedon Nov 10, 2026
Thank you so much for this careful report, and you're right.
gen_wcc()assigned Simpson's weights by 1-based vector position instead of by time, so
the vector was
1/3, 2/3, 4/3, …instead of1/3, 4/3, 2/3, …. Lauren Steimleindependently reported the same issue by email, and we've credited you both
in NEWS.md.
This is fixed in v0.3.0 (#3, release notes):
three cycles now use Simpson's 3/8 rule. Polynomials up to degree three are
still integrated exactly, and the weights sum to n.
darthtools::gen_wcc(), which has the same bug. A darthtools fix is inprogress.
tests, including your example.
In the base case, QALYs increase by about 0.32 per strategy and ICERs change
by about 0.4%. The frontier and dominance results don't change. The before/after
table is in NEWS.md, and
manuscript/README.mdrecords the erratum for thepublished article's code.
Thanks again for taking the time to dig into this!