Repository navigation
Incremental CE plane and WTP lines in plot.icers() and plot.psa() (#209, #202) - #228
Merged
feralaes merged 1 commit intoNov 12, 2026
Merged
Conversation
…lines - plot.icers() gains ref_str, wtp, ref_axis, and ref_caption (after the existing arguments). ref_str shifts the plot so the reference strategy is at the origin (the frontier and statuses are unchanged); wtp draws a dotted line with slope wtp through the reference, or without ref_str through the least costly frontier strategy. The currency defaults to the one stored by calculate_icers() (#209, #202). - plot.psa() gains wtp, which draws the same line on its incremental plane (requires ref_str) (#202). - plot.psa(ref_str = ) with two strategies: keep a data frame when one comparator is left (drop = FALSE); it failed with "'dims' cannot be of length 0". ref_str is now checked with check_ref_str(). - Captions name the reference and the WTP threshold; this also removes a double space in plot.psa()'s 'Reference Strategy: X' caption. - Tests (test_reference_plots.R) check the plotted coordinates, axis labels, captions, WTP line slope and intercept, currency, the two-strategy case, and the errors. Default plots are unchanged. Part of #209
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.
Second PR of the reference-strategy series (#209), covering the plots. It also adds the willingness-to-pay line requested in #202.
Part of #209. Covers the WTP-line part of #202; the quadrant table is in the next PR.
Example
Left,
plot.icers(ref_str, wtp): the reference is at the origin, the frontier and statuses are unchanged, and the dotted line is the WTP threshold. Right,plot.psa(ref_str, wtp), usingcancer_psa_data. Both captions name the reference and the threshold, e.g. "Reference Strategy: Chemotherapy; Dotted line: WTP = $50,000/QALY".What changed
plot.icers()gainsref_str,wtp,ref_axisandref_caption. These are the same namesplot.psa()already uses, and they're added after the existing arguments.ref_strmoves the reference strategy to the origin (the incremental plane), with dashed axes. It only moves the axes: dominance and the frontier are unchanged.wtpdraws a dotted line with slopewtpthrough the reference. Withoutref_str, it goes through the least costly strategy on the frontier.calculate_icers(currency = ).plot.psa()gainswtp, the same line on its incremental plane. It requiresref_str, because the absolute plane has no natural anchor for the line.plot.psa(ref_str = )with only two strategies failed with "'dims' cannot be of length 0". With a single comparator, the subsetting dropped to a vector; it now usesdrop = FALSE.ref_stris checked with the sharedcheck_ref_str().plot.psa()'s existing caption ("Reference Strategy: X" → "Reference Strategy: X"). That is the only change to any existing output (thepsa_analysisvignette's caption).Tests
New
test_reference_plots.R:plot.psa(): the two-strategy case now plots the correct differences.wtpwithoutref_strand for an unknownref_str.Verification
R CMD check --as-cran, with 0 errors, 0 warnings and 1 NOTE (the development version number).psa_analysisvignette. The plot data there is identical.Noted, not changed
plot.icers()shows its cost axis without thousands separators ("-16000"), whileplot.psa()uses them ("60,000"). This predates this PR and fits the plot-argument harmonization issue (#214).