mexhazLT {xhaz} | R Documentation |
mexhazLT function
Description
Extends excess hazard models from the mexhaz R-
package to allow rescaling (Goungounga et al. (2019) doi:10.1186/s12874-019-0747-3) of the background mortality in the presence or absence of multilevel data (Goungounga et al. (2023) <doi: 10.1002/bimj.202100210>).
It allows for different shapes of the baseline hazard, the ability to include time-
dependent effects of variable(s), and a random effect at the cluster level.
Usage
mexhazLT(
formula,
data,
expected = "expected",
expectedCum = "expectedCum",
pophaz = "classic",
base = c("weibull", "exp.bs", "exp.ns", "pw.cst"),
degree = 3,
knots = NULL,
bound = NULL,
n.gleg = 20,
init = NULL,
random = NULL,
n.aghq = 10,
fnoptim = c("nlm", "optim"),
verbose = 0,
method = "Nelder-Mead",
iterlim = 10000,
numHess = FALSE,
print.level = 1,
exactGradHess = TRUE,
gradtol = ifelse(exactGradHess, 1e-08, 1e-06),
testInit = TRUE,
keep.data = FALSE,
...
)
Arguments
formula |
a formula object of the function with the response on the left
of a |
data |
a data frame in which the variables named in the formula are to be interpreted. |
expected |
name of the variable (must be given in quotes) representing the population instantaneous hazard. |
expectedCum |
name of the variable (must be given in quotes) representing the population cumulative hazard. |
pophaz |
specifies two possible arguments in character: classic and
rescaled. If |
base |
functional form that should be used to model the baseline hazard.
Selection can be made between the following options: |
degree |
if |
knots |
if |
bound |
a vector of two numerical values corresponding to the boundary
knots of the spline functions. If |
n.gleg |
corresponds to the number of quadrature nodes to be specified as in |
init |
vector of initial values as in |
random |
name of the variable to be entered as a random effect (must be
given between quotes), representing the cluster membership. As in |
n.aghq |
corresponds to the number of quadrature points to be specified
as in |
fnoptim |
name of the R optimisation procedure used to maximise the
likelihood. Selection can be made between "nlm" (by default) and "optim".
Note: if |
verbose |
integer parameter representing the frequency at which the current state of the optimisation process is displayed. If verbose=0 (default), nothing is displayed. |
method |
if fnoptim="optim", method represents the optimisation method to
be used by optim. By default, |
iterlim |
if |
numHess |
logical value allowing the user to choose between the Hessian
returned by the optimization algorithm (default) or the Hessian estimated by
the hessian function from the |
print.level |
his argument is only used if |
exactGradHess |
logical value allowing the user to decide whether
maximisation of the likelihood should be based on the analytic gradient and
Hessian computed internally (default, corresponding to |
gradtol |
this argument is only used if |
testInit |
this argument is used only when |
keep.data |
logical argument determining whether the dataset should be
kept in the object returned by the function: this can be useful in certain
contexts (e.g., to calculate cluster |
... |
other parameters used with the |
Value
An object of class mexhaz
, xhaz
or mexhazLT
.
This object is a list containing the following components:
dataset |
name of the dataset used to fit the model. |
call |
function call on which the model is based. |
formula |
formula part of the call. |
withAlpha |
logical value indicating whether the model corresponds to a class of models correcting for life tables. |
expected |
name of the variable corresponding to the population hazard. |
expectedCum |
name of the variable corresponding to the cumulative population hazard. |
xlevels |
information concerning the levels of the categorical variables used in the model. |
n.obs.tot |
total number of observations in the dataset. |
n.obs |
number of observations used to fit the model (after exclusion of missing values). |
n.events |
number of events (after exclusion of missing values). |
n.clust |
number of clusters. |
n.time.0 |
number of observations for which the observed follow-up time was equal to 0 (only for right censored type data). |
base |
function used to model the baseline hazard. |
max.time |
maximal observed time in the dataset. |
boundary.knots |
vector of boundary values used to define the B |
degree |
degree of the B |
knots |
vector of interior knots used to define the B |
names.ph |
names of the covariables with a proportional effect. |
random |
name of the variable defining cluster membership (set to NA in the case of a purely fixed effects model). |
init |
a vector containing the initial values of the parameters. |
coefficients |
a vector containing the parameter estimates. |
std.errors |
a vector containing the standard errors of the parameter estimates. |
vcov |
the variance-covariance matrix of the estimated parameters. |
gradient |
the gradient of the log |
hessian |
the Hessian of the log |
mu.hat |
a data.frame containing the estimated cluster |
var.mu.hat |
the covariance matrix of the cluster |
vcov.fix.mu.hat |
a matrix containing the covariances between the fixed effect and the cluster |
data |
original dataset used to fit the model (if |
n.par |
number of estimated parameters. |
n.gleg |
number of Gauss |
n.aghq |
number of adaptive Gauss |
fnoptim |
name of the R optimisation procedure used to maximise the likelihood. |
method |
optimisation method used by optim. |
code |
code (integer) indicating the status of the optimisation process (this code has a different meaning for nlm and for optim: see their respective help page for details). |
loglik |
value of the log |
iter |
number of iterations used in the optimisation process. |
eval |
number of evaluations used in the optimisation process. |
time.elapsed |
total time required to reach convergence. |
Note
time
is OBLIGATORY in YEARS.
Author(s)
Juste Goungounga, Hadrien Charvat, Nathalie Graffeo, Roch Giorgi
References
Goungounga JA, Touraine C, Graff\'eo N, Giorgi R; CENSUR working survival group. Correcting for misclassification and selection effects in estimating net survival in clinical trials. BMC Med Res Methodol. 2019 May 16;19(1):104. doi: 10.1186/s12874-019-0747-3. PMID: 31096911; PMCID: PMC6524224. (PubMed)
Goungounga, JA, Graff\'eo N, Charvat H, Giorgi R. “Correcting for heterogeneity and non-comparability bias in multicenter clinical trials with a rescaled random-effect excess hazard model.” Biometrical journal. Biometrische Zeitschrift vol. 65,4 (2023): e2100210. doi:10.1002/bimj.202100210.PMID: 36890623; (PubMed)
Examples
library("numDeriv")
library("survexp.fr")
library("splines")
library("statmod")
data("breast")
# load the data sets 'breast'.
# Flexible mexhaz model: baseline excess hazard with cubic B-splines
# assumption on the life table available :
# other cause mortality in the cohort is comparable to the mortality
# observed in the general population with the same characteristics.
# The life table to be used is survexp.us. Note that SEX is coded 2 instead of female in survexp.us.
breast$sexe <- "female"
fit.haz <- exphaz(
formula = Surv(temps, statut) ~ 1,
data = breast, ratetable = survexp.us,
only_ehazard = FALSE,
rmap = list(age = 'age', sex = 'sexe', year = 'date'))
breast$expected <- fit.haz$ehazard
breast$expectedCum <- fit.haz$ehazardInt
mod.bs <- mexhazLT(formula = Surv(temps, statut) ~ agecr + armt,
data = breast,
ratetable = survexp.us, degree = 3,
knots=quantile(breast[breast$statut==1,]$temps, probs=c(1:2/3)),
expected = "expected",expectedCum = "expectedCum",
base = "exp.bs", pophaz = "classic")
mod.bs
# Flexible mexhaz model: baseline excess hazard with cubic B-splines
# assumption on the life table available :
# other cause mortality in the cohort is different to the mortality
# observed in the general population with the same characteristics.
mod.bs2 <- mexhazLT(formula = Surv(temps, statut) ~ agecr + armt,
data = breast, degree = 3,
knots=quantile(breast[breast$statut==1,]$temps, probs=c(1:2/3)),
expected = "expected",expectedCum = "expectedCum",
base = "exp.bs", pophaz = "rescaled")
mod.bs2
# Flexible mexhaz model with a random effects at cluster level:
# baseline excess hazard with cubic B-splines
# assumption on the life table used :
# other cause mortality in the cohort is different to the mortality
# observed in the general population with the same characteristics.
mod.bs3 <- mexhazLT(formula = Surv(temps, statut) ~ agecr + armt,
data = breast, degree = 3,
knots=quantile(breast[breast$statut==1,]$temps, probs=c(1:2/3)),
expected = "expected",expectedCum = "expectedCum",
base = "exp.bs", pophaz = "rescaled", random = "hosp")
mod.bs3