flexsurvcure: Mixture and Non-Mixture Parametric Cure Models

View source: R/flexsurvcure.R

flexsurvcureR Documentation

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")

flexsurvcure documentation built on Nov. 2, 2022, 1:07 a.m.