Package 'blendR'

Title: Blended Survival Curves
Description: Create blended survival curves, see 'Che et al.' (2022) <doi:10.1177/0272989X221134545>.
Authors: Nathan Green [aut] , Che Zhaojing [aut, cph, cre]
Maintainer: Che Zhaojing <[email protected]>
License: GPL (>= 3)
Version: 1.0.0
Built: 2025-03-05 06:35:45 UTC
Source: https://github.com/StatisticsHealthEconomics/blendR

Help Index


Blended survival object

Description

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.

Usage

blendsurv(
  obs_Surv,
  ext_Surv,
  blend_interv,
  beta_params = list(alpha = 3, beta = 3),
  times = NULL,
  nsim = 100
)

Arguments

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

Value

List of S for observed, external and blended curves.

Examples

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)

Survival data

Description

Survival data


Create an external survival data based on expert opinion

Description

Generally, the sampling is done is two steps

p(T)=p(Tintervali)p(intervali)p(T) = p(T | interval i) p(interval i)

Usage

ext_surv_sim(t_info, S_info, T_max, n = 100)

Arguments

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_info

T_max

The maximum survival time to be used

n

The number of patients to construct the artificial external data set; default 100

Details

In particular T U(xi,xi+1)T ~ U(x_{i}, x_{i+1}) i multinomial(π^)i ~ multinomial(\hat{\pi})

Value

Dataframe of times and censoring status

Examples

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)

Description

Generate survival estimates with a piecewise exponential Cox model (using INLA)

Usage

fit_inla_pw(
  inla.formula = inla.surv(death_t, death) ~ -1,
  data,
  cutpoints,
  nsim = 100,
  ...
)

Arguments

inla.formula

The formula for PEM which must be an inla.surv object

data

A dataframe for survival data with time (death_t) and event (death)

cutpoints

A sequence of cut points for intervals in the baseline hazard

nsim

The number of simulations from posteriors; default 100

...

Additional arguments

Value

INLA object

Examples

## Not run: 
data("TA174_FCR", package = "blendR")
head(dat_FCR)

obs_Surv <- fit_inla_pw(data = dat_FCR, cutpoints = seq(0, 180, by = 5))

## End(Not run)

Create survival probabilities

Description

These function are version of the survHE::make.surv() function from survHE. These are needed prior to blending.

Usage

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, ...)

Arguments

Surv

survival analysis object

...

Additional arguments

t

Time points; vector

nsim

Number of simulations; integer

Value

matrix of survival probabilities

Examples

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)

Blended survival plot with manipulate

Description

RStudio bug need to run base R first manipulate(plot(1:x), x = slider(5, 10))

Usage

manip_plot(obs_Surv, ext_Surv, blend_interv)

Arguments

obs_Surv

Observed survival

ext_Surv

External survival

blend_interv

Blending interval

Value

Blended survival plot


Blended survival curve based on short-term data and external information

Description

Blended survival curve based on short-term data and external information

Usage

## S3 method for class 'blended'
plot(x, alpha = c(0.1, 0.05), ...)

Arguments

x

A blended survival curve object obtain from blendsurv()

alpha

A vector specifying the opacity of ribbon for the blended curve and other curves

...

Additional arguments

Value

ggplot2 object

See Also

blendsurv()

Examples

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

Description

Plots the weights for the blending procedure

Usage

weightplot(x, ...)

Arguments

x

A blended survival curve object obtained from blendsurv()

...

Additional arguments

Value

ggplot2 object

See Also

blendsurv()