| Title: | Blended Survival Curves |
|---|---|
| Description: | Create a blended curve from two survival curves, which is particularly useful for survival extrapolation in health technology assessment. The main idea is to mix a flexible model that fits the observed data well with a parametric model that encodes assumptions about long-term survival. The two curves are blended into a single survival curve that is identical to the first model over the range of observed times and gradually approaches the parametric model over the extrapolation period based on a given weight function. This approach allows for the inclusion of external information, such as data from registries or expert opinion, to guide long-term extrapolations, especially when dealing with immature trial data. See Che et al. (2022) <doi:10.1177/0272989X221134545>. |
| Authors: | Nathan Green [aut] (ORCID: <https://orcid.org/0000-0003-2745-1736>, ROR: <https://ror.org/02jx3x895>), Zhaojing Che [aut, cph, cre] (ORCID: <https://orcid.org/0000-0003-2245-1606>, ROR: <https://ror.org/052gg0110>) |
| Maintainer: | Zhaojing Che <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.0.0 |
| Built: | 2026-06-04 08:39:43 UTC |
| Source: | https://github.com/cran/blendR |
This is the main function in the blendR package. Two survival curves are supplied and blended according to the blending distribution characterised by the blending interval and the beta distribution parameters.
blendsurv( obs_Surv, ext_Surv, blend_interv, beta_params = list(alpha = 3, beta = 3), times = NULL, nsim = 100 )blendsurv( obs_Surv, ext_Surv, blend_interv, beta_params = list(alpha = 3, beta = 3), times = NULL, nsim = 100 )
obs_Surv, ext_Surv
|
Observed and external data survival curves. These can come from survHE, INLA or flexsurv fits. |
blend_interv |
Maximum and minimum values for the blending interval. |
beta_params |
coefficients of a beta distribution |
times |
A vector of times for which the survival curves are to be computed; optional |
nsim |
The number of simulations from the distribution of the survival curves; default 100 |
List of S for observed, external and blended curves.
library(survHE) ## trial data data("TA174_FCR", package = "blendR") ## externally estimated data data_sim <- ext_surv_sim(t_info = 144, S_info = 0.05, T_max = 180) obs_Surv <- fit.models(formula = Surv(death_t, death) ~ 1, data = dat_FCR, distr = "exponential", method = "hmc") ext_Surv <- fit.models(formula = Surv(time, event) ~ 1, data = data_sim, distr = "exponential", method = "hmc") blend_interv <- list(min = 48, max = 150) beta_params <- list(alpha = 3, beta = 3) ble_Surv <- blendsurv(obs_Surv, ext_Surv, blend_interv, beta_params) plot(ble_Surv)library(survHE) ## trial data data("TA174_FCR", package = "blendR") ## externally estimated data data_sim <- ext_surv_sim(t_info = 144, S_info = 0.05, T_max = 180) obs_Surv <- fit.models(formula = Surv(death_t, death) ~ 1, data = dat_FCR, distr = "exponential", method = "hmc") ext_Surv <- fit.models(formula = Surv(time, event) ~ 1, data = data_sim, distr = "exponential", method = "hmc") blend_interv <- list(min = 48, max = 150) beta_params <- list(alpha = 3, beta = 3) ble_Surv <- blendsurv(obs_Surv, ext_Surv, blend_interv, beta_params) plot(ble_Surv)
Generally, the sampling is done is two steps
ext_surv_sim(t_info, S_info, T_max, n = 100)ext_surv_sim(t_info, S_info, T_max, n = 100)
t_info |
A vector of times for which expert opinion is elicited |
S_info |
A vector of mean survival probabilities estimated by experts
corresponding to time points in |
T_max |
The maximum survival time to be used |
n |
The number of patients to construct the artificial external data set; default 100 |
In particular
Dataframe of times and censoring status
dat <- ext_surv_sim(t_info = c(10,20,50), S_info = c(0.9, 0.8, 0.2), T_max = 100, n = 100) if (require(survival)) { km_fit <- survfit(Surv(time, event) ~ 1, data = dat) plot(km_fit) }dat <- ext_surv_sim(t_info = c(10,20,50), S_info = c(0.9, 0.8, 0.2), T_max = 100, n = 100) if (require(survival)) { km_fit <- survfit(Surv(time, event) ~ 1, data = dat) plot(km_fit) }
Generate survival estimates with a piecewise exponential Cox model (using INLA)
fit_inla_pw( inla.formula = inla.surv(death_t, death) ~ -1, data, cutpoints, nsim = 100, ... )fit_inla_pw( inla.formula = inla.surv(death_t, death) ~ -1, data, cutpoints, nsim = 100, ... )
inla.formula |
The formula for PEM which must be an |
data |
A dataframe for survival data with time ( |
cutpoints |
A sequence of cut points for intervals in the baseline hazard |
nsim |
The number of simulations from posteriors; default 100 |
... |
Additional arguments |
INLA object
if (requireNamespace("INLA", quietly = TRUE)) { data("TA174_FCR", package = "blendR") head(dat_FCR) obs_Surv <- fit_inla_pw(data = dat_FCR, cutpoints = seq(0, 180, by = 5)) }if (requireNamespace("INLA", quietly = TRUE)) { data("TA174_FCR", package = "blendR") head(dat_FCR) obs_Surv <- fit_inla_pw(data = dat_FCR, cutpoints = seq(0, 180, by = 5)) }
These function are version of the survHE::make.surv() function
from survHE. These are needed prior to blending.
make_surv(Surv, ...) ## S3 method for class 'survHE' make_surv(Surv, t, nsim = 100, ...) ## S3 method for class 'flexsurvreg' make_surv(Surv, t = NULL, nsim = 100, ...) ## S3 method for class 'inla' make_surv(Surv, t = NULL, nsim = 100, ...) ## Default S3 method: make_surv(Surv, t = NULL, nsim = 100, ...)make_surv(Surv, ...) ## S3 method for class 'survHE' make_surv(Surv, t, nsim = 100, ...) ## S3 method for class 'flexsurvreg' make_surv(Surv, t = NULL, nsim = 100, ...) ## S3 method for class 'inla' make_surv(Surv, t = NULL, nsim = 100, ...) ## Default S3 method: make_surv(Surv, t = NULL, nsim = 100, ...)
Surv |
survival analysis object |
... |
Additional arguments |
t |
Time points; vector |
nsim |
Number of simulations; integer |
Matrix of survival probabilities
library(survHE) ## trial data data("TA174_FCR", package = "blendR") ## externally estimated data data_sim <- ext_surv_sim(t_info = 144, S_info = 0.05, T_max = 180) ext_Surv <- fit.models(formula = Surv(time, event) ~ 1, data = data_sim, distr = "exponential", method = "hmc") S_ext <- make_surv(ext_Surv, t = 1:100, nsim = 100)library(survHE) ## trial data data("TA174_FCR", package = "blendR") ## externally estimated data data_sim <- ext_surv_sim(t_info = 144, S_info = 0.05, T_max = 180) ext_Surv <- fit.models(formula = Surv(time, event) ~ 1, data = data_sim, distr = "exponential", method = "hmc") S_ext <- make_surv(ext_Surv, t = 1:100, nsim = 100)
RStudio bug
need to run base R first
manipulate(plot(1:x), x = slider(5, 10))
manip_plot(obs_Surv, ext_Surv, blend_interv)manip_plot(obs_Surv, ext_Surv, blend_interv)
obs_Surv |
Observed survival |
ext_Surv |
External survival |
blend_interv |
Blending interval |
Blended survival plot
Blended survival curve based on short-term data and external information
## S3 method for class 'blended' plot(x, alpha = c(0.1, 0.05), ...)## S3 method for class 'blended' plot(x, alpha = c(0.1, 0.05), ...)
x |
A blended survival curve object obtain from |
alpha |
A vector specifying the opacity of ribbon for the blended curve and other curves |
... |
Additional arguments |
A ggplot2 object
library(survHE) ## trial data data("TA174_FCR", package = "blendR") ## externally estimated data data_sim <- ext_surv_sim(t_info = 144, S_info = 0.05, T_max = 180) obs_Surv <- fit.models(formula = Surv(death_t, death) ~ 1, data = dat_FCR, distr = "exponential", method = "hmc") ext_Surv <- fit.models(formula = Surv(time, event) ~ 1, data = data_sim, distr = "exponential", method = "hmc") blend_interv <- list(min = 48, max = 150) beta_params <- list(alpha = 3, beta = 3) ble_Surv <- blendsurv(obs_Surv, ext_Surv, blend_interv, beta_params) plot(ble_Surv)library(survHE) ## trial data data("TA174_FCR", package = "blendR") ## externally estimated data data_sim <- ext_surv_sim(t_info = 144, S_info = 0.05, T_max = 180) obs_Surv <- fit.models(formula = Surv(death_t, death) ~ 1, data = dat_FCR, distr = "exponential", method = "hmc") ext_Surv <- fit.models(formula = Surv(time, event) ~ 1, data = data_sim, distr = "exponential", method = "hmc") blend_interv <- list(min = 48, max = 150) beta_params <- list(alpha = 3, beta = 3) ble_Surv <- blendsurv(obs_Surv, ext_Surv, blend_interv, beta_params) plot(ble_Surv)
Plots the weights for the blending procedure
weightplot(x, ...)weightplot(x, ...)
x |
A blended survival curve object obtained from |
... |
Additional arguments |
ggplot2 object