Title: | Parametric Cure Model Estimation |
---|---|
Description: | Contains functions for estimating generalized parametric mixture and non-mixture cure models, loss of lifetime, mean residual lifetime, and crude event probabilities. |
Authors: | Lasse Hjort Jakobsen [aut, cre], Mark Clements [cph], Rasmus Kuhr Jensen [ctb], Lars Klingen Gjærde [ctb] |
Maintainer: | Lasse Hjort Jakobsen <[email protected]> |
License: | GPL (>=2) |
Version: | 1.1.1 |
Built: | 2025-02-20 04:45:43 UTC |
Source: | https://github.com/lassehjort/cure |
This function computes the AIC for a fitted parametric cure model.
## S3 method for class 'cm' AIC(object, ..., k = 2)
## S3 method for class 'cm' AIC(object, ..., k = 2)
object |
Object of class cm or gfcm. |
... |
Additionally arguments. Not currently used |
k |
Number to control if either AIC or BIC is to be computed (default is 2 equal to AIC). |
This function computes the AIC for a fitted parametric cure model.
## S3 method for class 'gfcm' AIC(object, ..., k = 2)
## S3 method for class 'gfcm' AIC(object, ..., k = 2)
object |
Object of class cm or gfcm. |
... |
Additionally arguments. Not currently used |
k |
Number to control if either AIC or BIC is to be computed (default is 2 equal to AIC). |
This function computes the BIC for a fitted parametric cure model.
## S3 method for class 'cm' BIC(object, ...)
## S3 method for class 'cm' BIC(object, ...)
object |
Object of class cm or gfcm. |
... |
Some methods for this generic function may take additional, optional arguments. At present none do. |
This function computes the BIC for a fitted parametric cure model.
## S3 method for class 'gfcm' BIC(object, ...)
## S3 method for class 'gfcm' BIC(object, ...)
object |
Object of class cm or gfcm. |
... |
Some methods for this generic function may take additional, optional arguments. At present none do. |
Generate the B-spline basis matrix for a polynomial spline with derivative restrictions at the boundary knots.
bsx( x, df = NULL, knots = NULL, degree = 3, intercept = FALSE, Boundary.knots = range(x), deriv = NULL )
bsx( x, df = NULL, knots = NULL, degree = 3, intercept = FALSE, Boundary.knots = range(x), deriv = NULL )
x |
the predictor variable. Missing values are allowed. |
df |
degrees of freedom; one can specify |
knots |
the internal breakpoints that define the spline. The default is |
degree |
degree of the piecewise polynomial—default is |
intercept |
if |
Boundary.knots |
boundary points at which to anchor the B-spline basis (default the range of the non-NA data).
If both |
deriv |
an integer vector of length 2 with values between 0 and |
A matrix with containing the basis functions evaluated in x
.
Function for computing crude event probabilties based on relative survival models.
calc.Crude( object, newdata = NULL, type = c("disease", "other", "condother"), time = NULL, tau = 100, reverse = FALSE, var.type = c("ci", "se", "n"), exp.fun = NULL, ratetable = cuRe::survexp.dk, rmap, scale = ayear, smooth.exp = FALSE, pars = NULL, link = "loglog", n = 100 )
calc.Crude( object, newdata = NULL, type = c("disease", "other", "condother"), time = NULL, tau = 100, reverse = FALSE, var.type = c("ci", "se", "n"), exp.fun = NULL, ratetable = cuRe::survexp.dk, rmap, scale = ayear, smooth.exp = FALSE, pars = NULL, link = "loglog", n = 100 )
object |
Fitted model to do predictions from. Possible classes are
|
newdata |
Data frame from which to compute predictions. If empty, predictions are made on the the data which the model was fitted on. |
type |
Probability to compute. Possible values are |
time |
Time points at which to compute predictions. If empty, a grid of 100 time points between 0
and |
tau |
Upper bound of the integral used to compute the probability of disease-related death (see details).
The argument is only used for |
reverse |
Logical. If |
var.type |
Character. Possible values are " |
exp.fun |
Object of class |
ratetable |
Object of class |
rmap |
List to be passed to |
scale |
Numeric. Passed to the |
smooth.exp |
Logical. If |
pars |
A vector of parameter values for the model given in |
link |
Link function for computing variance in order to restrict confidence intervals to [0, 1].
Default is |
n |
Number of knots used for the Gauss-Legendre quadrature. |
The function estimates crude probabilities by using the relative survival, expected survival,
and the cause-specific hazard function.
The crude cumulative incidence of disease-related death (type = "disease"
) is
The crude cumulative incidence of death from other causes (type = "other"
) is
The conditional probability of eventually dying from other causes than disease (type = "condother"
) is
The probability of disease-related death, P(D = disease),
can be computed by using type = "disease"
and choosing a sufficiently large time point.
For P(D = other| T>t), the argument tau
controls this time point (default is 100).
A list containing the crude probability estimates
of each individual in newdata
.
##Use data cleaned version of the colon disease data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 1000), ] ##Extract general population hazards colonDC$bhaz <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"), data = colonDC, ratetable = survexp.dk) ##Spline-base cure model #Fit cure model fit <- rstpm2::stpm2(Surv(FUyear, status) ~ 1, data = colonDC, df = 6, bhazard = colonDC$bhaz, cure = TRUE) #Compute the probability of disease-related death res <- calc.Crude(fit, time = seq(0, 20, length.out = 50), rmap = list(age = agedays, sex = sex, year = dx), var.type = "n") plot(res) #Compute the conditional probability of dying from other causes than disease res <- calc.Crude(fit, time = seq(0, 20, length.out = 50), type = "condother", rmap = list(age = agedays, sex = sex, year = dx), var.type = "n") plot(res) #Simple parametric cure model #Fit cure model fit <- fit.cure.model(Surv(FUyear, status) ~ 1, data = colonDC, bhazard = "bhaz", type = "mixture", dist = "weibull", link = "logit") #Compute the probability of disease-related death res <- calc.Crude(fit, time = seq(0, 20, length.out = 50), rmap = list(age = agedays, sex = sex, year = dx), var.type = "n") plot(res) #Compute the conditional probability of disease-related death res2 <- calc.Crude(fit, time = seq(0, 20, length.out = 50), type = "condother", rmap = list(age = agedays, sex = sex, year = dx), reverse = TRUE, var.type = "n") plot(res2)
##Use data cleaned version of the colon disease data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 1000), ] ##Extract general population hazards colonDC$bhaz <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"), data = colonDC, ratetable = survexp.dk) ##Spline-base cure model #Fit cure model fit <- rstpm2::stpm2(Surv(FUyear, status) ~ 1, data = colonDC, df = 6, bhazard = colonDC$bhaz, cure = TRUE) #Compute the probability of disease-related death res <- calc.Crude(fit, time = seq(0, 20, length.out = 50), rmap = list(age = agedays, sex = sex, year = dx), var.type = "n") plot(res) #Compute the conditional probability of dying from other causes than disease res <- calc.Crude(fit, time = seq(0, 20, length.out = 50), type = "condother", rmap = list(age = agedays, sex = sex, year = dx), var.type = "n") plot(res) #Simple parametric cure model #Fit cure model fit <- fit.cure.model(Surv(FUyear, status) ~ 1, data = colonDC, bhazard = "bhaz", type = "mixture", dist = "weibull", link = "logit") #Compute the probability of disease-related death res <- calc.Crude(fit, time = seq(0, 20, length.out = 50), rmap = list(age = agedays, sex = sex, year = dx), var.type = "n") plot(res) #Compute the conditional probability of disease-related death res2 <- calc.Crude(fit, time = seq(0, 20, length.out = 50), type = "condother", rmap = list(age = agedays, sex = sex, year = dx), reverse = TRUE, var.type = "n") plot(res2)
The following function estimates the time to statistical cure using the conditional probability of disease-related death.
calc.Crude.quantile( fit, q = 0.05, newdata = NULL, max.time = 20, exp.fun = NULL, var.type = c("ci", "se", "n"), rmap, ratetable = cuRe::survexp.dk, tau = 100, reverse = TRUE, scale = ayear )
calc.Crude.quantile( fit, q = 0.05, newdata = NULL, max.time = 20, exp.fun = NULL, var.type = c("ci", "se", "n"), rmap, ratetable = cuRe::survexp.dk, tau = 100, reverse = TRUE, scale = ayear )
fit |
Fitted model to do predictions from. Possible classes are
|
q |
Threshold to estimate statistical cure according to. |
newdata |
Data frame from which to compute predictions. If empty, predictions are made on the the data which the model was fitted on. |
max.time |
Upper boundary of the interval [0, |
exp.fun |
Object of class |
var.type |
Character. Possible values are " |
rmap |
List to be passed to |
ratetable |
Object of class |
tau |
Upper bound of integral (see ?calc.Crude). Default is 100. |
reverse |
Logical passed on to |
scale |
Numeric. Passed to the |
The cure point is calculated as the time point at which the conditional probability of disease-related
death reaches the threshold, q
. If q
is not reached within max.time
, no solution is reported.
The estimated cure point.
##Use data cleaned version of the colon cancer data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 500), ] ##Extract general population hazards colonDC$bhaz <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"), data = colonDC, ratetable = survexp.dk) #Fit cure model and estimate cure point fit <- rstpm2::stpm2(Surv(FUyear, status) ~ 1, data = colonDC, df = 6, bhazard = colonDC$bhaz, cure = TRUE) cp <- calc.Crude.quantile(fit, q = 0.05, rmap = list(age = agedays, sex = sex, year = dx)) #Compare the result with the trajectory of the conditional probability of disease-related death res <- calc.Crude(fit, type = "condother", time = seq(0, 20, length.out = 100), var.type = "n", rmap = list(age = agedays, sex = sex, year = dx), reverse = TRUE) plot(res) abline(h = 0.05, v = cp$Estimate)
##Use data cleaned version of the colon cancer data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 500), ] ##Extract general population hazards colonDC$bhaz <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"), data = colonDC, ratetable = survexp.dk) #Fit cure model and estimate cure point fit <- rstpm2::stpm2(Surv(FUyear, status) ~ 1, data = colonDC, df = 6, bhazard = colonDC$bhaz, cure = TRUE) cp <- calc.Crude.quantile(fit, q = 0.05, rmap = list(age = agedays, sex = sex, year = dx)) #Compare the result with the trajectory of the conditional probability of disease-related death res <- calc.Crude(fit, type = "condother", time = seq(0, 20, length.out = 100), var.type = "n", rmap = list(age = agedays, sex = sex, year = dx), reverse = TRUE) plot(res) abline(h = 0.05, v = cp$Estimate)
The following function estimates the time to statistical cure using the conditional probability of cure.
calc.cure.quantile( fit, q = 0.05, newdata = NULL, max.time = 20, var.type = c("ci", "n"), reverse = TRUE, bdr.knot = NULL )
calc.cure.quantile( fit, q = 0.05, newdata = NULL, max.time = 20, var.type = c("ci", "n"), reverse = TRUE, bdr.knot = NULL )
fit |
Fitted model to do predictions from. Possible classes are
|
q |
Threshold to estimate statistical cure according to. |
newdata |
Data frame from which to compute predictions. If empty, predictions are made on the the data which the model was fitted on. |
max.time |
Upper boundary of the interval [0, |
var.type |
Character. Possible values are " |
reverse |
Logical. Whether to use the conditional probability of not being cured (default) or the conditional probability of cure. |
bdr.knot |
Time point from which cure is assumed. Only relevant for class |
The cure point is calculated as the time point at which the conditional probability of disease-related
death reaches the threshold, q
. If q
is not reached within max.time
, no solution is reported.
The estimated cure point.
##Use data cleaned version of the colon cancer data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 1000), ] ##Extract general population hazards colonDC$bhaz <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"), data = colonDC, ratetable = survexp.dk) #Fit cure model and estimate cure point fit <- GenFlexCureModel(Surv(FUyear, status) ~ 1, data = colonDC, df = 5, bhazard = "bhaz") calc.cure.quantile(fit, q = 0.05)
##Use data cleaned version of the colon cancer data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 1000), ] ##Extract general population hazards colonDC$bhaz <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"), data = colonDC, ratetable = survexp.dk) #Fit cure model and estimate cure point fit <- GenFlexCureModel(Surv(FUyear, status) ~ 1, data = colonDC, df = 5, bhazard = "bhaz") calc.cure.quantile(fit, q = 0.05)
Function for computing mean residual lifetime and loss of lifetime estimates based on relative survival models.
calc.LL( object, newdata = NULL, type = c("ll", "mrl"), time = NULL, tau = 100, var.type = c("ci", "se", "n"), exp.fun = NULL, ratetable = cuRe::survexp.dk, rmap, smooth.exp = FALSE, scale = ayear, pars = NULL, n = 100 )
calc.LL( object, newdata = NULL, type = c("ll", "mrl"), time = NULL, tau = 100, var.type = c("ci", "se", "n"), exp.fun = NULL, ratetable = cuRe::survexp.dk, rmap, smooth.exp = FALSE, scale = ayear, pars = NULL, n = 100 )
object |
Fitted model to do predictions from. Possible classes are
|
newdata |
Data frame from which to compute predictions. If empty, predictions are made on the the data which the model was fitted on. |
type |
Type of life expectation estimate.
Possible values are |
time |
Time points at which to compute predictions. If empty, a grid of 100 time points between 0
and |
tau |
The upper limit of the integral (see details). Default is 100. |
var.type |
Character. Possible values are " |
exp.fun |
Object of class |
ratetable |
Object of class |
rmap |
List to be passed to |
smooth.exp |
Logical. If |
scale |
Numeric. Passed to the |
pars |
A vector of parameter values for the model given in |
n |
Number of knots used for the Gauss-Legendre quadrature. |
The mean residual lifetime function and loss of lifetime function are based on numerical
integration of the area under the observed and expected conditional survival functions.
If type = "ll"
, the function computes
If type = "mrl"
, the function computes
for a given t. The function is the general population survival function and
is the observed survival function. Integration to infinity is not required in studies of human mortality,
so an upper limit,
tau
, is chosen instead. As most humans die before they 100 years, this is
the default setting of the function. The integral is computed by Gauss-Legendre quadrature
and the point wise variance is estimated using the delta method and numerical differentiation.
An object of class le
containing the life expectancy estimates
of each individual in newdata
.
##Use data cleaned version of the colon cancer data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 1000), ] ##Extract general population hazards colonDC$bhaz <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"), data = colonDC, ratetable = survexp.dk) ##Spline-base cure model #Fit cure model fit <- rstpm2::stpm2(Surv(FUyear, status) ~ 1, data = colonDC, df = 6, bhazard = colonDC$bhaz, cure = TRUE) #Compute and plot the loss of lifetime function res <- calc.LL(fit, time = seq(0, 20, length.out = 50), rmap = list(age = agedays, sex = sex, year = dx), var.type = "n") plot(res) #Compute and plot the mean residual lifetime res <- calc.LL(fit, time = seq(0, 20, length.out = 50), type = "mrl", rmap = list(age = agedays, sex = sex, year = dx), var.type = "n") plot(res) #Simple parametric cure model #Fit cure model fit <- fit.cure.model(Surv(FUyear, status) ~ 1, data = colonDC, bhazard = "bhaz", type = "mixture", dist = "weibull", link = "logit") #Compute and plot the loss of lifetime function res <- calc.LL(fit, time = seq(0, 20, length.out = 50), rmap = list(age = agedays, sex = sex, year = dx), var.type = "n") plot(res) #Compute and plot the mean residual lifetime res <- calc.LL(fit, time = seq(0, 20, length.out = 50), type = "mrl", rmap = list(age = agedays, sex = sex, year = dx), var.type = "n") plot(res)
##Use data cleaned version of the colon cancer data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 1000), ] ##Extract general population hazards colonDC$bhaz <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"), data = colonDC, ratetable = survexp.dk) ##Spline-base cure model #Fit cure model fit <- rstpm2::stpm2(Surv(FUyear, status) ~ 1, data = colonDC, df = 6, bhazard = colonDC$bhaz, cure = TRUE) #Compute and plot the loss of lifetime function res <- calc.LL(fit, time = seq(0, 20, length.out = 50), rmap = list(age = agedays, sex = sex, year = dx), var.type = "n") plot(res) #Compute and plot the mean residual lifetime res <- calc.LL(fit, time = seq(0, 20, length.out = 50), type = "mrl", rmap = list(age = agedays, sex = sex, year = dx), var.type = "n") plot(res) #Simple parametric cure model #Fit cure model fit <- fit.cure.model(Surv(FUyear, status) ~ 1, data = colonDC, bhazard = "bhaz", type = "mixture", dist = "weibull", link = "logit") #Compute and plot the loss of lifetime function res <- calc.LL(fit, time = seq(0, 20, length.out = 50), rmap = list(age = agedays, sex = sex, year = dx), var.type = "n") plot(res) #Compute and plot the mean residual lifetime res <- calc.LL(fit, time = seq(0, 20, length.out = 50), type = "mrl", rmap = list(age = agedays, sex = sex, year = dx), var.type = "n") plot(res)
The following function estimates the time to statistical cure using the loss of lifetime function.
calc.LL.quantile( fit, q = 1, newdata = NULL, max.time = 20, var.type = c("ci", "n"), exp.fun = NULL, rmap = NULL, ratetable = cuRe::survexp.dk, tau = 100, type = "ll", scale = ayear )
calc.LL.quantile( fit, q = 1, newdata = NULL, max.time = 20, var.type = c("ci", "n"), exp.fun = NULL, rmap = NULL, ratetable = cuRe::survexp.dk, tau = 100, type = "ll", scale = ayear )
fit |
Fitted model to do predictions from. Possible classes are
|
q |
Threshold to estimate statistical cure according to. |
newdata |
Data frame from which to compute predictions. If empty, predictions are made on the the data which the model was fitted on. |
max.time |
Upper boundary of the interval [0, |
var.type |
Character. Possible values are " |
exp.fun |
Object of class |
rmap |
List to be passed to |
ratetable |
Object of class |
tau |
Upper bound of integral (see ?calc.LL). Default is 100. |
type |
Type of life expectancy measure. Possible values are |
scale |
Numeric. Passed to the |
The estimated cure point.
##Use data cleaned version of the colon cancer data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 1000), ] ##Extract general population hazards colonDC$bhaz <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"), data = colonDC, ratetable = survexp.dk) #Fit cure model and estimate cure point fit <- rstpm2::stpm2(Surv(FUyear, status) ~ 1, data = colonDC, df = 6, bhazard = colonDC$bhaz, cure = TRUE) calc.LL.quantile(fit, q = 1, rmap = list(age = agedays, sex = sex, year = dx))
##Use data cleaned version of the colon cancer data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 1000), ] ##Extract general population hazards colonDC$bhaz <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"), data = colonDC, ratetable = survexp.dk) #Fit cure model and estimate cure point fit <- rstpm2::stpm2(Surv(FUyear, status) ~ 1, data = colonDC, df = 6, bhazard = colonDC$bhaz, cure = TRUE) calc.LL.quantile(fit, q = 1, rmap = list(age = agedays, sex = sex, year = dx))
Function for computing the basis matrix for restricted cubic splines
cb(x, df = NULL, knots = NULL, ortho = FALSE, R.inv = NULL, intercept = FALSE)
cb(x, df = NULL, knots = NULL, ortho = FALSE, R.inv = NULL, intercept = FALSE)
x |
Values to evaluate the basis functions in. |
df |
Degrees of freedom. One can supply |
knots |
Chosen knots for the spline. |
ortho |
Logical. If |
R.inv |
Matrix or vector containing the values of the R matrix from the QR decomposition of the basis matrix.
This is used for making new predictions based on the initial orthogonalization.
Therefore the default is |
intercept |
Logical. If |
A matrix with containing the basis functions evaluated in x
.
Royston P. and Parmar M.K. (2002) Flexible parametric proportional-hazards and proportional-odds models for censored survival data, with application to prognostic modelling and estimation of treatment effects. Statistics in Medicine, 21:15.
Function for computing the basis matrix for restricted cubic splines which are constant beyond the last knot
cbc(x, df = NULL, knots = NULL, ortho = FALSE, R.inv = NULL, intercept = FALSE)
cbc(x, df = NULL, knots = NULL, ortho = FALSE, R.inv = NULL, intercept = FALSE)
x |
Values to evaluate the basis functions in. |
df |
Degrees of freedom. One can supply |
knots |
Chosen knots for the spline. |
ortho |
Logical. If |
R.inv |
Matrix or vector containing the values of the R matrix from the QR decomposition of the basis matrix.
This is used for making new predictions based on the initial orthogonalization.
Therefore the default is |
intercept |
Logical. If |
A matrix with containing the basis functions evaluated in x
.
Andersson T.M.-L., et al. (2011) Estimating and modelling cure in population-based cancer studies within the framework of flexible parametric survival models. BMC Medical Research Methodology, 11:96.
A dataset containing the individual baseline and follow-up data on more than 15,000
colon cancer patient. The data is a cleaned version of the rstpm2::colon
data set.
data(colonDC)
data(colonDC)
A data frame with 15564 rows and 11 variables
sex. Either female or male
age. Diagnostic age
stage. Clinical stage at diagnosis (either unknown, localised, regional, or distant)
statusDC. Alive indicator with cause of death
subsite. Anatomical subsite of tumour (either coecum and ascending, transverse, descending and sigmoid, or other and NOS)
dx. Date of diagnosis
exit. Date of study exit
status. Alive indicator (0 = alive, 1 = dead)
FU. Follow-up time measured in days
FUyear. Follow-up time measured in years
agedays. Diagnostic age in days.
This function fits parametric cure models using simple parametric distributions.
fit.cure.model( formula, data, formula.surv = NULL, type = c("mixture", "nmixture"), dist = c("weibull", "exponential", "lognormal", "weiwei", "weiexp", "gmw"), link = c("logit", "loglog", "identity", "probit"), bhazard = NULL, covariance = TRUE, link.mix = c("logit", "loglog", "identity", "probit"), control = list(maxit = 10000), method = "Nelder-Mead", init = NULL )
fit.cure.model( formula, data, formula.surv = NULL, type = c("mixture", "nmixture"), dist = c("weibull", "exponential", "lognormal", "weiwei", "weiexp", "gmw"), link = c("logit", "loglog", "identity", "probit"), bhazard = NULL, covariance = TRUE, link.mix = c("logit", "loglog", "identity", "probit"), control = list(maxit = 10000), method = "Nelder-Mead", init = NULL )
formula |
Formula for modelling the cure proportion. The left hand side
has to be of the form |
data |
Data frame in which to interpret the variable names in |
formula.surv |
List of formulas for each parameter in the parametric distribution (see details). |
type |
A character indicating the type of cure model.
Possible values are |
dist |
The parametric distribution of the survival of the uncured. |
link |
Character. Specifies the link function of the cure proportion. |
bhazard |
Background hazard. |
covariance |
Logical. If |
link.mix |
Character. Specifies the link function for the mixture parameter in a
weibull-weibull mixture model and weibull-exponential model. |
control |
List of control parameters passed to |
method |
Optimization method passed to |
init |
Initial values for the maximum likelihood optimization. If not provided, the optimization will start in 0. |
If type = "mixture"
, the function fits the model,
and if type = "nmixture"
, the function fits the model,
where z is a vector of covariates. The formula.surv
argument is used to model
(1 -
). It is a
list
of formulas with as many entries as there are
parameters in the chosen parametric distribution. If not specified, all formulas are assumed to be ~1
.
The ith formula, i.e., formula.surv[[i]]
refers to in the below survival functions.
Exponential model:
Weibull model:
Log-normal model:
Weibull-exponential mixture model:
Weibull-Weibull mixture model:
Generalized modified Weibull distribution:
In the Weibull-exponential and Weibull-Weibull mixture models, the link function for the mixture component is controlled by link.mix
.
The remaining parameters are modelled using an exponential link function except in the log-normal model,
which is modelled using the identity. Parameters are not transformed back to the original scale in
the outputted object and related
print.cm
and summary.cm
functions
An object of class cm
containing the estimated parameters of the cure model.
The appropriate link functions taken on and the
's are linear in the covariates corresponding to their respective parameter estimates.
##Use data cleaned version of the colon cancer data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 500), ] ##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 weibull mixture cure model fit.wei <- fit.cure.model(Surv(FUyear, status) ~ 1, data = colonDC, bhazard = "bhaz", type = "mixture", dist = "weibull", link = "logit") ##Plot various summaries of the model (see ?predict.cm) plot(fit.wei) plot(fit.wei, time = seq(0, 40, length.out = 100)) plot(fit.wei, type = "hazard") plot(fit.wei, type = "survuncured") plot(fit.wei, type = "probcure") #Fit a weibull-weibull mixture cure model fit.weiwei <- fit.cure.model(Surv(FUyear, status) ~ 1, data = colonDC, bhazard = "bhaz", type = "mixture", dist = "weiwei", link = "logit") #Compare to the weibull model plot(fit.wei, ci = FALSE) plot(fit.weiwei, add = TRUE, col = 2, ci = FALSE) ###With covariates ##Fit weibull mixture cure model with age effect for both components of the Weibull model fit <- fit.cure.model(Surv(FUyear, status) ~ age, data = colonDC, bhazard = "bhaz", formula.surv = list(~ age, ~ age), type = "mixture", dist = "weibull", link = "logit") ##Plot model for age 50 and 60 plot(fit, newdata = data.frame(age = 60), time = seq(0, 15, length.out = 100), ci = FALSE) plot(fit, newdata = data.frame(age = 50), time = seq(0, 15, length.out = 100), ci = FALSE, add = TRUE, col = 2) plot(fit, newdata = data.frame(age = 60), time = seq(0, 15, length.out = 100), ci = FALSE, type = "hazard") plot(fit, newdata = data.frame(age = 50), time = seq(0, 15, length.out = 100), ci = FALSE, type = "hazard", add = TRUE, col = 2)
##Use data cleaned version of the colon cancer data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 500), ] ##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 weibull mixture cure model fit.wei <- fit.cure.model(Surv(FUyear, status) ~ 1, data = colonDC, bhazard = "bhaz", type = "mixture", dist = "weibull", link = "logit") ##Plot various summaries of the model (see ?predict.cm) plot(fit.wei) plot(fit.wei, time = seq(0, 40, length.out = 100)) plot(fit.wei, type = "hazard") plot(fit.wei, type = "survuncured") plot(fit.wei, type = "probcure") #Fit a weibull-weibull mixture cure model fit.weiwei <- fit.cure.model(Surv(FUyear, status) ~ 1, data = colonDC, bhazard = "bhaz", type = "mixture", dist = "weiwei", link = "logit") #Compare to the weibull model plot(fit.wei, ci = FALSE) plot(fit.weiwei, add = TRUE, col = 2, ci = FALSE) ###With covariates ##Fit weibull mixture cure model with age effect for both components of the Weibull model fit <- fit.cure.model(Surv(FUyear, status) ~ age, data = colonDC, bhazard = "bhaz", formula.surv = list(~ age, ~ age), type = "mixture", dist = "weibull", link = "logit") ##Plot model for age 50 and 60 plot(fit, newdata = data.frame(age = 60), time = seq(0, 15, length.out = 100), ci = FALSE) plot(fit, newdata = data.frame(age = 50), time = seq(0, 15, length.out = 100), ci = FALSE, add = TRUE, col = 2) plot(fit, newdata = data.frame(age = 60), time = seq(0, 15, length.out = 100), ci = FALSE, type = "hazard") plot(fit, newdata = data.frame(age = 50), time = seq(0, 15, length.out = 100), ci = FALSE, type = "hazard", add = TRUE, col = 2)
Yearly general population hazards matched on age, gender, and calendar year is extracted from a ratetable.
general.haz( time, rmap, data = NULL, ratetable = cuRe::survexp.dk, scale = 365.24 )
general.haz( time, rmap, data = NULL, ratetable = cuRe::survexp.dk, scale = 365.24 )
time |
Either a numeric vector of follow-up times (in days) or a character indicating the variable containing the follow-up times in the data. |
rmap |
A named list. The names must match the dimension names of the ratetable input.
The elements should be given as vectors containing the relevant variables in the data
or a character indicating the name of the variable in the data.
Elements in the list named 'age' and 'year' are transformed such that the age and year of
the event/censoring time is used.
'age' must be a numeric vector given as age in days
or a character indicating the variable containing the patient ages in the data.
'year' must be of class |
data |
The data from which to extract variables from.
If |
ratetable |
Object of class |
scale |
Numeric to adjust the scale of the outputted hazard values.
If the ratetable provides daily hazards and |
An object of class numeric
containing the yearly expected hazards.
##Use data cleaned version of the colon cancer data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 1000), ] ##Extract general population hazards bhaz1 <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"), data = colonDC, ratetable = survexp.dk) bhaz2 <- general.haz(time = colonDC$FU, rmap = list(age = colonDC$agedays, sex = colonDC$sex, year = colonDC$dx), data = colonDC, ratetable = survexp.dk) all(bhaz2 == bhaz1)
##Use data cleaned version of the colon cancer data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 1000), ] ##Extract general population hazards bhaz1 <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"), data = colonDC, ratetable = survexp.dk) bhaz2 <- general.haz(time = colonDC$FU, rmap = list(age = colonDC$agedays, sex = colonDC$sex, year = colonDC$dx), data = colonDC, ratetable = survexp.dk) all(bhaz2 == bhaz1)
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
where
The function implements multiple link functions for both and
. 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") )
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 is used.
Using
link.type = 'PO'
, the link function 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))
##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))
Function for doing likelihood ratio tests for class cuRe
.
lrtest(model1, model2)
lrtest(model1, model2)
model1 |
A model fitted by the fit.cure.model or the GenFlexCureModel function |
model2 |
Another model fitted by the fit.cure.model or the GenFlexCureModel function for comparison. |
One of the models must be nested within the other model, and both models must be fitted to the same data set.
An object of class "anova" containing the degrees of freedom and log-likelihoods of the two models, the difference in degrees of freedom, the likelihood ratio Chi-squared statistic (twice the difference in log-likelihoods) , and the p-value for the asymptotic likelihood ratio test.
Function for computing survival estimates using a relative survival model and the expected general population survival.
lts( fit, type = c("surv", "hazard", "cumhaz", "loghaz", "fail"), newdata = NULL, time = NULL, var.type = c("ci", "se", "n"), exp.fun = NULL, ratetable = cuRe::survexp.dk, rmap, scale = 365.24, smooth.exp = FALSE, link = NULL, mean = FALSE )
lts( fit, type = c("surv", "hazard", "cumhaz", "loghaz", "fail"), newdata = NULL, time = NULL, var.type = c("ci", "se", "n"), exp.fun = NULL, ratetable = cuRe::survexp.dk, rmap, scale = 365.24, smooth.exp = FALSE, link = NULL, mean = FALSE )
fit |
Fitted model to do predictions from. Possible classes are |
type |
Prediction type (see details). The default is |
newdata |
Data frame from which to compute predictions. If empty, predictions are made on the the data which the model was fitted on. |
time |
Optional time points at which to compute predictions. If empty, a grid of 100 time points between 0 and the maximum follow-up time is selected. |
var.type |
Character. Possible values are " |
exp.fun |
Object of class |
ratetable |
Object of class |
rmap |
List to be passed to |
scale |
Numeric. Passed to the |
smooth.exp |
Logical. If |
link |
Character, indicating the link function for the variance calculations.
Possible values are " |
mean |
Logical. If |
Possible values for argument type
are:surv
: Survival function computed by hazard
: Hazard function computed by cumhaz
: The cumulative hazard function computed by loghazard
: The log-hazard function computed by fail
: The distribution function computed by
An object of class lts
containing the predictions of each individual in newdata
.
##Use data cleaned version of the colon cancer data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 1000), ] ##Extract general population hazards colonDC$bhaz <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"), data = colonDC, ratetable = survexp.dk) ##Fit flexible parametric relative survival model fit <- stpm2(Surv(FUyear, status) ~ 1, data = colonDC, df = 6, bhazard = colonDC$bhaz) ##Compute survival probabilities from 0 to 20 years pred <- lts(fit, rmap = list(age = agedays, sex = sex, year = dx)) ##Plot the survival function plot(pred)
##Use data cleaned version of the colon cancer data from the rstpm2 package data("colonDC") set.seed(2) colonDC <- colonDC[sample(1:nrow(colonDC), 1000), ] ##Extract general population hazards colonDC$bhaz <- general.haz(time = "FU", rmap = list(age = "agedays", sex = "sex", year= "dx"), data = colonDC, ratetable = survexp.dk) ##Fit flexible parametric relative survival model fit <- stpm2(Surv(FUyear, status) ~ 1, data = colonDC, df = 6, bhazard = colonDC$bhaz) ##Compute survival probabilities from 0 to 20 years pred <- lts(fit, rmap = list(age = agedays, sex = sex, year = dx)) ##Plot the survival function plot(pred)
Plot function for the computed crude event probabilties.
## S3 method for class 'crude' plot(x, ylim = c(0, 1), xlim = NULL, ci = T, col = 1, ylab = NULL, xlab = "Time", add = F, ...)
## S3 method for class 'crude' plot(x, ylim = c(0, 1), xlim = NULL, ci = T, col = 1, ylab = NULL, xlab = "Time", add = F, ...)
x |
Object of class |
ylim |
Limits of y-axis. |
xlim |
Limits of x-axis. |
ci |
Logical. If |
col |
Colour of each curve. |
ylab |
Label of the y-axis. If |
xlab |
Label of the x-axis (default is "Time"). |
add |
Logical indicating wether the cruves should be added to the current plot window (default is |
... |
Further arguments passed to |
Plot function associated with the classes gfcm
and cm
## S3 method for class 'cuRe' plot(x, newdata = NULL, type = c("surv", "probcure", "survuncured", "hazarduncured", "cumhazuncured", "densityuncured", "failuncured", "oddsuncured", "loghazarduncured", "hazard", "density", "fail", "loghazard", "odds", "cumhaz"), time = NULL, xlim = NULL, ylim = c(0, 1), xlab = "Time", ylab = NULL, col = 1, ci = T, add = F, ...)
## S3 method for class 'cuRe' plot(x, newdata = NULL, type = c("surv", "probcure", "survuncured", "hazarduncured", "cumhazuncured", "densityuncured", "failuncured", "oddsuncured", "loghazarduncured", "hazard", "density", "fail", "loghazard", "odds", "cumhaz"), time = NULL, xlim = NULL, ylim = c(0, 1), xlab = "Time", ylab = NULL, col = 1, ci = T, add = F, ...)
x |
Object of class |
newdata |
Data frame from which to compute predictions. If empty, predictions are made on the the data which the model was fitted on. |
type |
Character. Defines the desired scale to plot. See ?predict.gfcm for possible values. |
time |
Optional time points at which to compute predictions.
This argument is not used if type is |
xlim |
Limits of the x-axis. |
ylim |
Limits of the y-axis. |
xlab |
Label of the x-axis. Default is "Time". |
ylab |
Label of the y-axis. If |
col |
Colour of each line. |
ci |
Logical. If |
add |
Loglca. If |
... |
Further arguments passed to |
A plot containing the predictions of each observation in newdata
.
Plot function for the class le
## S3 method for class 'le' plot(x, ylim = NULL, xlim = NULL, ci = T, col = 1, ylab = NULL, xlab = "Time", add = F, ...)
## S3 method for class 'le' plot(x, ylim = NULL, xlim = NULL, ci = T, col = 1, ylab = NULL, xlab = "Time", add = F, ...)
x |
Object of class |
ylim |
Limit of the y-axis. |
xlim |
Limit of x-axis. |
ci |
Logical. If |
col |
Numeric or character indicating the colours of the curves. |
ylab |
Label to be written on the y-axis. |
xlab |
Label to be written on the x-axis. |
add |
Logical. If |
... |
Further argument passed to |
Plot function for the class lts
.
## S3 method for class 'lts' plot(x, ylim = NULL, xlim = NULL, ci = T, col = 1, ylab = NULL, xlab = "Time", add = F, ...)
## S3 method for class 'lts' plot(x, ylim = NULL, xlim = NULL, ci = T, col = 1, ylab = NULL, xlab = "Time", add = F, ...)
x |
Object of class |
ylim |
Limit of the y-axis. |
xlim |
Limit of x-axis. |
ci |
Logical. If |
col |
Numeric or character indicating the colours of the curves. |
ylab |
Label to be written on the y-axis. If |
xlab |
Label to be written on the x-axis. |
add |
Logical indicating whether to add to current plot window (default is FALSE). |
... |
Further argument passed to |
Function for doing predictions for class cm
.
## S3 method for class 'cm' predict(object, newdata = NULL, type = c("surv", "curerate", "probcure", "survuncured", "hazarduncured", "cumhazuncured","densityuncured", "failuncured", "oddsuncured", "loghazarduncured","hazard", "density", "fail", "loghazard", "odds", "cumhaz"), time = NULL, var.type = c("ci", "se", "n"), pars = NULL, link = NULL, keep.attributes = F, ...)
## S3 method for class 'cm' predict(object, newdata = NULL, type = c("surv", "curerate", "probcure", "survuncured", "hazarduncured", "cumhazuncured","densityuncured", "failuncured", "oddsuncured", "loghazarduncured","hazard", "density", "fail", "loghazard", "odds", "cumhaz"), time = NULL, var.type = c("ci", "se", "n"), pars = NULL, link = NULL, keep.attributes = F, ...)
object |
Object of class |
newdata |
Data frame from which to compute predictions. If empty, predictions are made on the data which the model was fitted on. |
type |
Prediction type (see details). The default is |
time |
Optional time points at which to compute predictions.
This argument is not used if type is |
var.type |
Character. Possible values are " |
pars |
Numerical vector containing the parameters values of the model. In general, this argument can be ignored by the user. |
link |
Character, indicating the link function for the variance calculations.
Possible values are " |
keep.attributes |
Logical. If |
... |
Additional arguments. Currently not used. |
Possible values for argument type
are:surv
: Survival functioncurerate
: The cure fractionprobcure
: The conditional probability of being curedsurvuncured
: The survival of the uncuredhazarduncured
: The hazard function of the uncuredcumhazuncured
: The cumulative hazard of the uncureddensityuncured
: The density function of the uncuredfailuncured
: The distribution function of the uncured, i.e., 1 - survuncured
oddsuncured
: Odds of the uncured, i.e., (1 - survuncured
) / survuncured
loghazarduncured
: The log-hazard of the uncuredhazard
: The hazard functiondensity
: The density functionfail
: The distribution functionloghazard
: The log-hazard functionodds
: The odds, i.e., (1 - surv
) / surv
cumhaz
: The cumulative hazard function
A list containing the predictions of each individual in newdata
.
Function for doing predictions for class gfcm
.
## S3 method for class 'gfcm' predict(object, newdata = NULL, type = c("surv", "curerate", "probcure", "survuncured", "hazarduncured", "cumhazuncured", "densityuncured", "failuncured", "oddsuncured", "loghazarduncured","hazard", "density", "fail", "loghazard", "odds", "cumhaz"), indi = TRUE, time = NULL, var.type = c("ci", "se", "n"), pars = NULL, link = NULL, keep.attributes = FALSE, ...)
## S3 method for class 'gfcm' predict(object, newdata = NULL, type = c("surv", "curerate", "probcure", "survuncured", "hazarduncured", "cumhazuncured", "densityuncured", "failuncured", "oddsuncured", "loghazarduncured","hazard", "density", "fail", "loghazard", "odds", "cumhaz"), indi = TRUE, time = NULL, var.type = c("ci", "se", "n"), pars = NULL, link = NULL, keep.attributes = FALSE, ...)
object |
Object of class |
newdata |
Data frame from which to compute predictions. If empty, predictions are made on the data which the model was fitted on. |
type |
Prediction type (see details). The default is |
indi |
Logical. If |
time |
Optional time points at which to compute predictions.
This argument is not used if type is |
var.type |
Character. Possible values are " |
pars |
Numerical vector containing the parameters values of the model. In general, this argument can be ignored by the user. |
link |
Character, indicating the link function for the variance calculations.
Possible values are " |
keep.attributes |
Logical. If |
... |
Additional arguments. Currently not used. |
Possible values for argument type
are:surv
: Survival functioncurerate
: The cure fractionprobcure
: The conditional probability of being curedsurvuncured
: The survival of the uncuredhazarduncured
: The hazard function of the uncuredcumhazuncured
: The cumulative hazard of the uncureddensityuncured
: The density function of the uncuredfailuncured
: The distribution function of the uncured, i.e., 1 - survuncured
oddsuncured
: Odds of the uncured, i.e., (1 - survuncured
) / survuncured
loghazarduncured
: The log-hazard of the uncuredhazard
: The hazard functiondensity
: The density functionfail
: The distribution functionloghazard
: The log-hazard functionodds
: The odds, i.e., (1 - surv
) / surv
cumhaz
: The cumulative hazard function
A list containing the predictions of each individual in newdata
.
Object of class ratetable
containing the daily hazards in the Danish general population
as reported by the Human Mortality Database (www.mortality.org).
survexp.dk
survexp.dk
An object of class ratetable
of dimension 111 x 180 x 2.
The ratetable was generated by using the relsurv::transrate.hmd
function.
The data were downloaded on 15-09-2017 seperately for male and female Danish citizens.
The data can be accessed through:
Female: http://www.mortality.org/hmd/DNK/STATS/fltper_1x1.txt
Male: http://www.mortality.org/hmd/DNK/STATS/mltper_1x1.txt