GenFlexCureModel: Fit generalized mixture cure model

Description Usage Arguments Details Value Examples

View source: R/GenFlexCureModel.R

Description

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.

Usage

1
2
3
4
5
6
7
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"))

Arguments

formula

Formula for modelling the survival of the uncured. Reponse has to be of the form Surv(time, status).

data

Data frame in which to interpret the variables names in formula, smooth.formula, tvc.formula, and cr.formula.

smooth.formula

Formula for describing the time-effect of the survival of the uncured. If NULL (default), the function uses the natural cubic splines modelled on the log-time scale.

smooth.args

List. Optional arguments to the time-effect of the survival of the uncured (default is NULL).

df

Integer. Degrees of freedom (default is 3) for the time-effect of the survival of the uncured. Is not used if smooth.formula is provided.

tvc

Named list of integers. Specifies the degrees of freedom for time-varying covariate effects. For instance, tvc = list(x = 3) creates a time-varying spline-effect of the covariate "x" with 3 degrees of freedom using the rstpm2::nsx function.

tvc.formula

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

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 mixture for mixture cure models (default) and nmixture for non-mixture cure models.

link.type.cr

Character providing the link function for the cure proportion. Possible values are logit (default), loglog, identity, and probit.

link.type

Character providing the link function for the survival of the uncured. Possible values are PH for a proportional hazards model (default), PO for a proportion odds model, and probit for a probit model.

init

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

baseoff

Logical. If TRUE, the time-effect is modelled only using tvc.formula rather than merging with smooth.formula.

timeVar

Optional character giving the name of the variable specifying the time component of the Surv object. Should currently not be used.

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 TRUE (default), the covariance matrix is computed.

verbose

Logical. If TRUE status messages of the function is outputted.

control

Named list with control arguments passed to optim.

method

Character passed to optim indicating the method for optimization. See ?optim for details.

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

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.

Value

An object of class gfcm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
##Use data cleaned version of the colon cancer data from the rstpm2 package
data("colonDC")

##Extract general population hazards
colonDC$bhaz <- general.haz(time = "FU", 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 = F)
plot(fit, newdata = data.frame(sex = factor("male", levels = c("male", "female"))),
     time = seq(0.001, 15, length.out = 100), col = 2, ci = F, add = T)


plot(fit, newdata = data.frame(sex = factor("female", levels = c("male", "female"))),
     time = seq(0.001, 15, length.out = 100), ci = F, 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 = F,
     add = T, 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 = T, col = 2)

plot(fit, type = "hazard", newdata = data.frame(gender = 0), ci = F)
plot(fit, type = "hazard", newdata = data.frame(gender = 1),
     add = T, col = 2, ci = F)

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


fit2 <- stpm2(Surv(FUyear, status) ~ gender, data = colonDC, df = 4,
              bhazard = colonDC$bhaz, tvc = list(gender = 2))
plot(fit2, newdata = data.frame(gender = 0), type = "hazard")

LasseHjort/cuRe documentation built on Sept. 23, 2018, 7:30 p.m.