View source: R/GenFlexCureModel.R

GenFlexCureModel | R Documentation |

The following function fits a generalized mixture or non-mixture cure model using a link function for the cure rate and for the survival of the uncured. For a mixture cure model, the model is specified by

*S(t|z) = π(z) + [1 - π(z)] S_u(t|z),*

where

*g_1[S_u(t|z)] = η_1(t, z)\qquad and \qquad g_2[π(z)] = η_2(z).*

The function implements multiple link functions for both *g_1* and *g_2*. The default time-effect
is natural cubic splines, but the function allows for the use of other smoothers.

GenFlexCureModel( formula, data, smooth.formula = NULL, smooth.args = NULL, df = 3, tvc = NULL, tvc.formula = NULL, bhazard = NULL, cr.formula = ~1, type = "mixture", link.type.cr = c("logit", "loglog", "identity", "probit"), link.type = c("PH", "PO", "probit"), init = NULL, baseoff = FALSE, timeVar = "", time0Var = "", covariance = T, verbose = T, control = list(maxit = 10000), method = "Nelder-Mead", constraint = TRUE, ini.types = c("cure", "flexpara") )

`formula` |
Formula for modelling the survival of the uncured. Reponse has to be of the form |

`data` |
Data frame in which to interpret the variables names in |

`smooth.formula` |
Formula for describing the time-effect of the survival of the uncured.
If |

`smooth.args` |
List. Optional arguments to the time-effect of the survival
of the uncured (default is |

`df` |
Integer. Degrees of freedom (default is 3) for the time-effect of the survival of the uncured.
Is not used if |

`tvc` |
Named list of integers. Specifies the degrees of freedom for time-varying covariate effects.
For instance, |

`tvc.formula` |
Formula for the time-varying covariate effects.
For time-varying effects, a linear term of the covariate has to be included in |

`bhazard` |
Background hazard. |

`cr.formula` |
Formula for the cure proportion. The left hand side of the formula is not used and should therefore not be specified. |

`type` |
A character indicating the type of cure model.
Possible values are |

`link.type.cr` |
Character providing the link function for the cure proportion.
Possible values are |

`link.type` |
Character providing the link function for the survival of the uncured.
Possible values are |

`init` |
Initial values for the optimization procedure. If not specified, the function will create initial values internally. |

`baseoff` |
Logical. If |

`timeVar` |
Optional character giving the name of the variable specifying the time component of the |

`time0Var` |
Optional character giving the name of the variable specifying the time start time component used for delayed entry. Should currently not be used. |

`covariance` |
Logical. If |

`verbose` |
Logical. If |

`control` |
Named list with control arguments passed to |

`method` |
Character passed to |

`constraint` |
Logical. Indicates whether non-negativity constraints should be forced upon the hazard of the uncured patients (see details). |

`ini.types` |
Character vector denoting the executed schemes for computing initial values (see details). |

The default smoother is natural cubic splines established by the `rstpm2::nsx`

function.
Functions such as `ns`

, `bs`

are readily available for usage. Also the `cb`

function in this package
can be used. Initial values are calculated by two procedures and the model is fitted under each set of initial values.
The model producing the highest likelihood is selected.

Using `link.type = 'PH'`

, the link function *g_1(x) = \log(-\log(x))* is used.
Using `link.type = 'PO'`

, the link function *g_1(x) = \log(\frac{x}{1 - x})* is used.

If `constraint = TRUE`

, a non-negative hazard of the uncured is ensured by a general penalization scheme.
If `constraint = FALSE`

, penalization is still employed, but on the all-cause hazard instead.

An object of class `gfcm`

.

##Use data cleaned version of the colon cancer data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 400), ] ##Extract general population hazards colonDC$bhaz <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"), data = colonDC, ratetable = survexp.dk) ###Without covariates ##Fit mixture cure model fit <- GenFlexCureModel(Surv(FUyear, status) ~ 1, data = colonDC, df = 4, bhazard = "bhaz") ##Plot model plot(fit) plot(fit, time = seq(0.001, 40, length.out = 100)) plot(fit, type = "hazard") plot(fit, type = "survuncured") plot(fit, type = "probcure") ##Predict cure proportion predict(fit, type = "curerate") ##Fit non-mixture cure model fit <- GenFlexCureModel(Surv(FUyear, status) ~ 1, data = colonDC, df = 4, bhazard = "bhaz", type = "nmixture") ##Plot relative survival plot(fit) ##Predict cure proportion predict(fit, type = "curerate") ###With covariates ##Fit mixture cure model fit <- GenFlexCureModel(Surv(FUyear, status) ~ sex, data = colonDC, df = 4, bhazard = "bhaz", cr.formula = ~ sex) ##Plot model plot(fit, newdata = data.frame(sex = factor("female", levels = c("male", "female"))), time = seq(0.001, 15, length.out = 100), ci = FALSE) plot(fit, newdata = data.frame(sex = factor("male", levels = c("male", "female"))), time = seq(0.001, 15, length.out = 100), col = 2, ci = FALSE, add = TRUE) plot(fit, newdata = data.frame(sex = factor("female", levels = c("male", "female"))), time = seq(0.001, 15, length.out = 100), ci = FALSE, type = "survuncured") plot(fit, newdata = data.frame(sex = factor("male", levels = c("male", "female"))), time = seq(0.001, 15, length.out = 100), col = 2, ci = FALSE, add = TRUE, type = "survuncured") predict(fit, type = "curerate", data.frame(sex = factor(c("male", "female"), levels = c("male", "female")))) ##Fit mixture cure model with time-varying covariates colonDC$gender <- as.numeric(colonDC$sex) - 1 fit <- GenFlexCureModel(Surv(FUyear, status) ~ gender, data = colonDC, df = 6, bhazard = "bhaz", cr.formula = ~ gender, tvc = list(gender = 2)) ##Plot model plot(fit, newdata = data.frame(gender = 0)) plot(fit, newdata = data.frame(gender = 1), add = TRUE, col = 2) plot(fit, type = "hazard", newdata = data.frame(gender = 0), ci = FALSE) plot(fit, type = "hazard", newdata = data.frame(gender = 1), add = TRUE, col = 2, ci = FALSE) #Predict cure proportions for a male and female patients predict(fit, type = "curerate", newdata = data.frame(gender = 0)) predict(fit, type = "curerate", newdata = data.frame(gender = 1))

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.