Skip to content

Commit 4eca477

Browse files
authored
Merge pull request #8 from Merck/feat-backhaz
Various improvements related to backhaz
2 parents aa6b600 + a5fca61 commit 4eca477

File tree

6 files changed

+47
-18
lines changed

6 files changed

+47
-18
lines changed

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 15 Jan 2024 - Version 0.2
1+
# 26 Jan 2024 - Version 0.2
22

33
This version provides additional functionality to the calculation of restricted mean durations in `calc_allrmds`. These estimates may now be constrained by a lifetable (see `calc_ltsurv`) and discounting may now be applied. A vignette describing how to use this functionality is provided: `vignette("background-mortality")`.
44

R/fitting-spl.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ fit_ends_mods_spl <- function(ds,
108108
fits.os <- fits.pps_cf <- fits.pps_cr <- NULL
109109
# Derive additional fields, as with regular function
110110
ds <- create_extrafields(ds, cuttime=0)
111-
dspps <- ds |> dplyr::filter(pps.durn>0)
111+
# For PPS analysis, require there to be a known progression event, plus a positive PPS
112+
dspps <- ds |> dplyr::filter(pps.durn>0, ttp.flag==1)
112113
# Captures lists of fitted models to each endpoint
113114
fits.ppd <- fit_mods_spl(durn1 = ds$tzero,
114115
durn2 = ds$ppd.durn,

R/fitting.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ fit_ends_mods_par <- function(ds,
173173
fits.ppd <- fits.ttp <- fits.pfs <- fits.os <- fits.pps_cf <- fits.pps_cr <- NULL
174174
# Derive additional fields, as with regular function
175175
ds <- create_extrafields(ds, cuttime)
176-
dspps <- ds |> dplyr::filter(pps.durn>0)
176+
# For PPS analysis, require there to be a known progression event, plus a positive PPS
177+
dspps <- ds |> dplyr::filter(pps.durn>0, ttp.flag==1)
177178
# Captures lists of fitted models to each endpoint
178179
fits.ppd <- fit_mods_par(durn1 = ds$tzero,
179180
durn2 = ds$ppd.durn,

R/resmeans.R

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ calc_allrmds <- function(simdat,
406406
if (inclset[1]!=0) {
407407
simdat <- simdat[inclset,]
408408
ds <- create_extrafields(simdat, cuttime)
409+
dspps <- ds |> dplyr::filter(pps.durn>0, ttp.flag==1)
409410
# Fit chosen distributions to each endpoint - PPD
410411
ts.ppd <- convert_fit2spec(dpam$ppd)
411412
fit.ppd <- fit_mods(durn1 = ds$tzero,
@@ -440,17 +441,17 @@ calc_allrmds <- function(simdat,
440441
)[[1]]
441442
# PPS CF - requires two time values
442443
ts.pps_cf <- convert_fit2spec(dpam$pps_cf)
443-
fit.pps_cf <- fit_mods(durn1 = ds$ttp.durn,
444-
durn2 = ds$os.durn,
445-
evflag = ds$pps.flag,
444+
fit.pps_cf <- fit_mods(durn1 = dspps$ttp.durn,
445+
durn2 = dspps$os.durn,
446+
evflag = dspps$pps.flag,
446447
type = ts.pps_cf$type,
447448
spec = ts.pps_cf$spec
448449
)[[1]]
449450
# PPS CR
450451
ts.pps_cr <- convert_fit2spec(dpam$pps_cr)
451-
fit.pps_cr <- fit_mods(durn1 = ds$tzero,
452-
durn2 = ds$pps.durn,
453-
evflag = ds$pps.flag,
452+
fit.pps_cr <- fit_mods(durn1 = dspps$tzero,
453+
durn2 = dspps$pps.durn,
454+
evflag = dspps$pps.flag,
454455
type = ts.pps_cr$type,
455456
spec = ts.pps_cr$spec
456457
)[[1]]

vignettes/background-mortality.Rmd

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,35 @@ knitr::opts_chunk$set(
2121

2222
This is the second in a series of vignettes illustrating methods for evaluating the fit and efficiency of three state oncology cost-effectiveness model structures, as described in an accompanying journal article.[1] The package is heavily dependent on [flexsurv](https://cran.r-project.org/package=flexsurv)).[2]
2323

24-
After fitting models, as described in `vignette("example")`, estimates of restricted mean durations in health states can be calculated after constraining for background mortality from a given life table. This background mortality is assumed to add to the mortality hazard observed in the dataset. In doing this, we must assume that the original dataset was NOT subject to this type of mortality. This is a common, pragmatic assumption in cost-effectiveness models. Further discussion of survival extrapolation incorporating general population mortality is provided by Sweeting et al.[3]
24+
After fitting models, as described in `vignette("example")`, estimates of restricted mean durations in health states can be calculated after constraining for background mortality from a given life table.
2525

26-
First, we discussing some underpinning math(s). Then we provide a demonstration of the calculations and modeling using some illustrative data.
26+
## What does constraining for background mortality mean?
2727

28-
## The math bit
28+
### Approach 1 - Constraining only the survival function
29+
30+
This background mortality is assumed to limit the survival function as follows.
31+
32+
$$
33+
S_{adjusted}(t) = \min \left[ S_{unadjusted}(t), S_{background}(t) \right]
34+
$$
35+
36+
This is a simple approach, and has been used at least one NICE technology appraisal: "Patient longevity is always the lesser of values generated from the disease-specific survival curve (after adjustment for treatment and functional status) and the survival curve for the general population according to age and sex." [3] However, this approach does not ensure that the hazard is at least as great as the hazard of background mortality.
37+
38+
### Approach 2 - Constraining the hazard function
39+
40+
A more reasonable adjustment would be that the hazard of background mortality acts as a constraint to the unadjusted hazard.[4]
41+
42+
$$
43+
h_{adjusted}(t) = \max \left[ h_{unadjusted}(t), h_{background}(t) \right]
44+
\implies S_{adjusted}(t) = \exp \left[ - \int_0^t h_{adjusted}(u) du \right]
45+
$$
46+
In either case, we must assume that the original dataset was NOT subject to background mortality. Although unlikely to be true, this is a common, pragmatic assumption in cost-effectiveness models as long as background mortality is relatively insignificant during trial follow-up.
47+
48+
### Approach 3 - Modeling excess hazard in the original dataset
49+
50+
The above approaches work by adjusting extrapolations made from models fitted to data assumed to be not subject to background mortality. If - as is likely - the population in the dataset were in fact subject to background mortality, then it would be better to model that dataset using excess hazard methods rather than to seek to make adjustments to extrapolations after the fact. Further discussion of survival extrapolation incorporating general population mortality is provided by Sweeting et al.[4]
51+
52+
## Deriving restricted mean duration estimates under Approach 1
2953

3054
Following the notation in the journal article supporting this
3155
package, where membership probabilities at time $t$ from baseline are
@@ -45,7 +69,7 @@ $l_x$ is an appropriate lifetable.
4569
We can also derive the average background mortality hazard for $t$ in the range $[t_1, t_2)$.
4670

4771
$$
48-
h_{gen}(t) = \frac{\log[S_{gen}(t_2)] - \log[S_{gen}(t_1)]}{t_2 - t_1}
72+
h_{gen}(t) = \frac{\log[S_{gen}(t_1)] - \log[S_{gen}(t_2)]}{t_2 - t_1}
4973
$$
5074

5175
### Partitioned Survival Model (PSM)
@@ -92,7 +116,7 @@ Suppose a discount rate $i$\% applies over unit time. Then the discounting facto
92116

93117
### Programming implications
94118

95-
The calculation of restricted mean durations in *psm3mkv* default to assume no life table constraints or discounting. However, when a lifetable is specified, then $S_{gen}(t)$ and $h_{gen}(t)$ are specified and constrains the estimates of restricted mean durations as indicated above. When a discount rate is specified, then the mean estimates reflect this also.
119+
The calculation of restricted mean durations in *psm3mkv* default to assume no life table constraints or discounting. However, when a lifetable is specified, then $S_{gen}(t)$ and $h_{gen}(t)$ are specified and constrain the estimated means as indicated. When a discount rate is specified, then the mean estimates reflect this also.
96120

97121
## Demonstration
98122

@@ -216,7 +240,7 @@ res1 |> dplyr::mutate(
216240
dplyr::across(c(pf, pd, os), ~ tibble::num(.x, digits = 1)))
217241
```
218242

219-
Then we derive a projection with lifetable constraints over the same time horizon.
243+
Then we derive a projection with lifetable constraints (according to Approach 1) over the same time horizon.
220244

221245
```{r proj2}
222246
# Run the calculation
@@ -276,4 +300,6 @@ A summary of the STM-CR estimates of mean time in PF is given in the table below
276300

277301
2. Jackson C, Metcalfe P, Amdahl J, Warkentin MT, Sweeting M, Kunzmann K. flexsurv: Flexible Parametric Survival and Multi-State Models. Available at: https://cran.r-project.org/package=flexsurv.
278302

279-
3. Sweeting et al. Survival Extrapolation Incorporating General Population Mortality Using Excess Hazard and Cure Models: A Tutorial. Med Decis Making 2023 Aug;43(6):737-748. [DOI: 10.1177/0272989X231184247](https://doi.org/10.1177/0272989X231184247)
303+
3. National Institute for Health and Care Excellence. Avalglucosidase alfa for treating Pompe disease. Technology appraisal guidance [TA821]. August 24, 2022. Available from: [https://www.nice.org.uk/guidance/ta821/documents/committee-papers](https://www.nice.org.uk/guidance/ta821/documents/committee-papers)
304+
305+
4. Sweeting et al. Survival Extrapolation Incorporating General Population Mortality Using Excess Hazard and Cure Models: A Tutorial. Med Decis Making 2023 Aug;43(6):737-748. [DOI: 10.1177/0272989X231184247](https://doi.org/10.1177/0272989X231184247)

vignettes/example.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ ptdgraphs$graph$pps + scale_color_npg()
251251

252252
1. Jackson C, Metcalfe P, Amdahl J, Warkentin MT, Sweeting M, Kunzmann K. flexsurv: Flexible Parametric Survival and Multi-State Models. Available at: https://cran.r-project.org/package=flexsurv.
253253

254-
2. Woods BS, Sideris E, Palmer S, Latimer N, Soares M. Partitioned Survival and State Transition Models for Healthcare Decision Making in Oncology: Where Are We Now? Value in Health 23(12):1613-21; 2020. DOI: 10.1016/j.jval.2020.08.2094
254+
2. Woods BS, Sideris E, Palmer S, Latimer N, Soares M. Partitioned Survival and State Transition Models for Healthcare Decision Making in Oncology: Where Are We Now? Value in Health 23(12):1613-21; 2020. [DOI: 10.1016/j.jval.2020.08.2094](https://doi.org/10.1016/j.jval.2020.08.2094)
255255

256-
3. Royston P and Parmar M. Flexible parametric proportional-hazards and proportional-odds models for censored survival data, with application to prognostic modelling and estimation of treatment effects. Statistics in Medicine 21(1):2175-2197; 2002. DOI: 10.1002/sim.1203
256+
3. Royston P and Parmar M. Flexible parametric proportional-hazards and proportional-odds models for censored survival data, with application to prognostic modelling and estimation of treatment effects. Statistics in Medicine 21(1):2175-2197; 2002. [DOI: 10.1002/sim.1203](https://doi.org/10.1002/sim.1203)
257257

258258
4. Hanpu Z. Predictive Evaluation Metrics in Survival Analysis. Vignette to the *SurvMetrics* R package. July 2021. Available from: https://cran.r-project.org/package=SurvMetrics/vignettes/SurvMetrics-vignette.html

0 commit comments

Comments
 (0)