Package 'flexsurvcure'

Title: Flexible Parametric Cure Models
Description: Flexible parametric mixture and non-mixture cure models for time-to-event data.
Authors: Jordan Amdahl [aut, cre]
Maintainer: Jordan Amdahl <[email protected]>
License: GPL (>= 2)
Version: 1.3.1
Built: 2024-11-16 03:50:17 UTC
Source: https://github.com/jrdnmdhl/flexsurvcure

Help Index


Mixture and Non-Mixture Parametric Cure Models

Description

Mixture and non-mixture cure models using flexible base distributions from the flexsurv package.

Usage

flexsurvcure(
  formula,
  data,
  weights,
  bhazard,
  subset,
  dist,
  na.action,
  link = "logistic",
  mixture = T,
  ...
)

Arguments

formula

A formula expression in conventional R linear modeling syntax. The response must be a survival object as returned by the Surv function, and any covariates are given on the right-hand side. For example,

Surv(time, dead) ~ age + sex

Surv objects of type="right","counting", "interval1" or "interval2" are supported, corresponding to right-censored, left-truncated or interval-censored observations.

If there are no covariates, specify 1 on the right hand side, for example Surv(time, dead) ~ 1.

By default, covariates are placed on the “theta” parameter of the distribution, representing the cure fraction, through a linear model with the selected link function.

Covariates can be placed on parameters of the base distribution by using the name of the parameter as a “function” in the formula. For example, in a Weibull model, the following expresses the scale parameter in terms of age and a treatment variable treat, and the shape parameter in terms of sex and treatment.

Surv(time, dead) ~ age + treat + shape(sex) + shape(treat)

However, if the names of the ancillary parameters clash with any real functions that might be used in formulae (such as I(), or factor()), then those functions will not work in the formula. A safer way to model covariates on ancillary parameters is through the anc argument to flexsurvreg.

survreg users should also note that the function strata() is ignored, so that any covariates surrounded by strata() are applied to the location parameter.

data

A data frame in which to find variables supplied in formula. If not given, the variables should be in the working environment.

weights

Optional variable giving case weights.

bhazard

Optional variable giving expected hazards for relative survival models.

subset

Vector of integers or logicals specifying the subset of the observations to be used in the fit.

dist

A string representing one of the built-in distributions of flexsurv. Surv(time, dead) ~ age + treat, anc = list(shape = ~ sex + treat)

na.action

a missing-data filter function, applied after any 'subset' argument has been used. Default is options()$na.action.

link

A string representing the link function to use for estimation of the cure fraction. Defaults to "logistic", but also supports "loglog", "probit", and "identity".

mixture

optional TRUE/FALSE to specify whether a mixture model should be fitted. Defaults to TRUE.

...

other arguments to be passed to flexsurvreg.

Details

This function works as a wrapper around flexsurvreg by dynamically constructing a custom distribution using wrappers to the pdf and cdf functions.

In a parametric mixture model, it is assumed that there exists a group of individuals who experience no excess mortality, with the proportion of such individuals being given by the cure fraction parameter, and a parametric distribution representing the excess mortality for the remaining individuals.

By contrast, a parametric non-mixture model simply rescales an existing parametric distribution such that the probability of survival asymptotically approaches the cure fraction parameter as time approaches infinity.

Examples

flexsurvcure(Surv(rectime,censrec)~group, data=bc, dist="weibull", anc=list(scale=~group))
flexsurvcure(Surv(rectime,censrec)~group, data=bc, dist="lnorm", mixture = FALSE)
flexsurvcure(Surv(rectime,censrec)~group, data=bc, dist="weibull", link="loglog")

Mixture cure models

Description

Probability density, distribution, quantile, random generation, hazard cumulative hazard, mean, and restricted mean functions for generic mixture cure models. These distribution functions take as arguments the corresponding functions of the base distribution used.

Usage

pmixsurv(pfun, q, theta, ...)

hmixsurv(dfun, pfun, x, theta, ...)

Hmixsurv(pfun, x, theta, ...)

dmixsurv(dfun, pfun, x, theta, ...)

qmixsurv(qfun, p, theta, ...)

rmixsurv(qfun, n, theta, ...)

rmst_mixsurv(pfun, t, theta, ...)

mean_mixsurv(pfun, theta, ...)

Arguments

pfun

The base distribution's cumulative distribution function.

theta

The estimated cure fraction.

...

additional parameters to be passed to the pdf or cdf of the base distribution.

dfun

The base distribution's probability density function.

x, q, t

Vector of times.

qfun

The base distribution's quantile function.

p

Vector of probabilities.

n

Number of random numbers to simulate.

Value

dmixsurv gives the density, pmixsurv gives the distribution function, hmixsurv gives the hazard and Hmixsurv gives the cumulative hazard.

qmixsurv gives the quantile function, which is computed by crude numerical inversion.

rmixsurv generates random survival times by using qmixsurv on a sample of uniform random numbers. Due to the numerical root-finding involved in qmixsurv, it is slow compared to typical random number generation functions.

mean_mixsurv and rmst_mixsurv give the mean and restricted mean survival times, respectively.

Author(s)

Jordan Amdahl <[email protected]>


Non-Mixture Cure Models

Description

Probability density, distribution, quantile, random generation, hazard cumulative hazard, mean, and restricted mean functions for generic non-mixture cure models. These distribution functions take as arguments the corresponding functions of the base distribution used.

Usage

pnmixsurv(pfun, q, theta, ...)

hnmixsurv(dfun, x, theta, ...)

Hnmixsurv(pfun, x, theta, ...)

dnmixsurv(dfun, pfun, x, theta, ...)

qnmixsurv(qfun, p, theta, ...)

rnmixsurv(qfun, n, theta, ...)

rmst_nmixsurv(pfun, t, theta, ...)

mean_nmixsurv(pfun, theta, ...)

Arguments

pfun

The base distribution's cumulative distribution function.

theta

The estimated cure fraction.

...

Parameters to be passed to the pdf or cdf of the base distribution.

dfun

The base distribution's probability density function.

x, q, t

Vector of times.

qfun

The base distribution's quantile function.

p

Vector of probabilities.

n

Number of random numbers to simulate.

Details

es dnmixsurv pnmixsurv qnmixsurv rnmixsurv hnmixsurv Hnmixsurv mean_nmixsurv rmst_nmixsurv

Value

dnmixsurv gives the density, pnmixsurv gives the distribution function, hnmixsurv gives the hazard and Hnmixsurv gives the cumulative hazard.

qnmixsurv gives the quantile function, which is computed by crude numerical inversion.

rnmixsurv generates random survival times by using qnmixsurv on a sample of uniform random numbers. Due to the numerical root-finding involved in qnmixsurv, it is slow compared to typical random number generation functions.

mean_nmixsurv and rmst_nmixsurv give the mean and restricted mean survival times, respectively.

Author(s)

Jordan Amdahl <[email protected]>