Skip to content

Reference strategy and quadrant shares in summary.psa() and calculate_icers_psa() (#209, #202) - #229

Merged
feralaes merged 1 commit into
209-reference-strategy-corefrom
209-reference-strategy-psa
Nov 12, 2026
Merged

feralaes merged 1 commit into
209-reference-strategy-corefrom
209-reference-strategy-psa

Conversation

@feralaes

Copy link
Copy Markdown
Collaborator

Third PR of the reference-strategy series (#209), covering the PSA summaries. It also adds the quadrant table requested in #202.

Stacked on #228 (plots), which is stacked on #227 (ICER table). The diff shows only this change.

Part of #209. Closes #202 (WTP line in #228, quadrant table here).

Example

summary(psa, ref_str = "Standard of care", wtp = 50000)
#>           Strategy meanCost meanEffect meanNMB meanIncCost meanIncEffect propNE propSE propSW propNW meanIncNMB propCostEffective
#> ...  one row per strategy; the reference row has NA in the comparison columns

calculate_icers_psa(psa, uncertainty = TRUE, ref_str = "Standard of care", wtp = 50000)
#> adds Lower_95_/Upper_95_ intervals next to Inc_Cost_ref, Inc_Effect_ref and iNMB_ref

What changed

  • summary.psa() gains ref_str and wtp, after calc_sds. Columns follow its existing camelCase.
    • With ref_str, the differences from the reference are computed in every PSA sample (paired):
      • meanIncCost, meanIncEffect.
      • propNE, propSE, propSW, propNW: the share of samples in each quadrant of the incremental CE plane. NE is more effective and more costly; SE is more effective and not more costly (dominant); SW is not more effective and not more costly; NW is not more effective and more costly (dominated). The four shares sum to 1.
      • The reference row is NA.
    • With wtp: meanNMB. With ref_str as well, meanIncNMB and propCostEffective, the share of samples in which the strategy has a higher NMB than the reference, i.e. lies below the WTP line.
  • calculate_icers_psa() gains ref_str, wtp and nhb, passed to calculate_icers().
    • With uncertainty = TRUE and a reference, it adds 95% intervals of the paired differences, placed next to each estimate: Lower_95_Inc_Cost_ref, Upper_95_Inc_Cost_ref, and the same for Inc_Effect_ref and iNMB_ref.
    • The icers class and attributes are now kept through the uncertainty joins. Without that, print(x, ref = "reference") would not find the reference.
  • print.icers(): every *_ref column now belongs to the reference view, so the intervals don't clutter the default table.
  • Doc fix found along the way: an unescaped % in roxygen starts an Rd comment. It had silently truncated two help pages: ?calculate_icers_psa read "whether or not 95" and stopped, and ?predict.metamodel was cut off the same way. Both are fixed. I scanned the package and found no other cases.

Please check: new column names

The column names are user-facing and weren't discussed on #209: meanIncCost, meanIncEffect, propNE/propSE/propSW/propNW, meanNMB, meanIncNMB, propCostEffective, and Lower_95_…_ref/Upper_95_…_ref. They follow the existing conventions of each function. Suggest changes before this merges, while renaming is still free.

Tests

New test_psa_reference.R:

  • Quadrant shares: a 4-sample PSA built so each sample falls in a different quadrant gives shares of exactly 0.25.
  • NMB columns: hand-computed meanIncNMB and propCostEffective.
  • Pass-through: calculate_icers_psa(ref_str, wtp, nhb) equals calculate_icers() on the PSA means.
  • Intervals: the bounds equal the quantiles of the paired differences, and the reference row is NA.
  • Existing columns: the frontier columns and existing intervals are unchanged.
  • Print views: the sequential and reference views.

Verification

  • Unchanged for existing calls: calculate_icers_psa() is identical to main's on cancer_psa_data and psa_cdiff, with and without uncertainty (objects, class, printed tables). summary.psa() is unchanged without the new arguments.
  • Tests and checks:

What's left of #209

A "Presenting results against a reference strategy" section in the basic_cea vignette, with references. I'll open it as a small follow-up PR, after which #209 can close.

…_icers_psa()

- summary.psa() gains ref_str and wtp (after calc_sds). With ref_str it
  adds meanIncCost, meanIncEffect, and the share of PSA samples in each
  quadrant of the incremental CE plane (propNE, propSE, propSW, propNW;
  NA for the reference). With wtp it adds meanNMB, and with ref_str also
  meanIncNMB and propCostEffective (share of samples with a higher NMB
  than the reference) (#209, #202).
- calculate_icers_psa() gains ref_str, wtp, and nhb, passed to
  calculate_icers(). With uncertainty = TRUE and ref_str, it adds 95%
  intervals of the sample-by-sample differences from the reference
  (Lower_95_/Upper_95_ for Inc_Cost_ref, Inc_Effect_ref, iNMB_ref). The
  icers class and attributes are now kept through the uncertainty joins.
- print.icers(): every *_ref column belongs to the reference view.
- Docs: escape % in roxygen. An unescaped % starts an Rd comment, which
  had silently truncated ?calculate_icers_psa ('whether or not 95') and
  ?predict.metamodel.

calculate_icers_psa() output for existing calls is identical to main's
(objects, class, and printed tables, with and without uncertainty).

Part of #209. Closes #202
Base automatically changed from 209-reference-strategy-plots to 209-reference-strategy-core November 12, 2026 22:29
@feralaes
feralaes merged commit caeda9e into 209-reference-strategy-core Nov 12, 2026
13 of 14 checks passed
@feralaes
feralaes deleted the 209-reference-strategy-psa branch November 12, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant