Learn R Programming

FastJM (version 1.7.0)

jmcs: Joint modeling of longitudinal continuous data and competing risks

Description

Joint modeling of longitudinal continuous data and competing risks

Usage

jmcs(
  ydata,
  cdata,
  long.formula,
  random = NULL,
  surv.formula,
  control = jmcs_control()
)

Value

Object of class jmcs with elements

beta

the vector of fixed effects for the linear mixed effects model.

gamma1

the vector of fixed effects for type 1 failure for the survival model.

gamma2

the vector of fixed effects for type 2 failure for the survival model. Valid only if CompetingRisk = TRUE.

nu1

the vector of association parameter(s) for type 1 failure.

nu2

the vector of association parameter(s) for type 2 failure. Valid only if CompetingRisk = TRUE.

H01

the matrix that collects baseline hazards evaluated at each uncensored event time for type 1 failure. The first column denotes uncensored event times, the second column the number of events, and the third columns the hazards obtained by Breslow estimator.

H02

the matrix that collects baseline hazards evaluated at each uncensored event time for type 2 failure. The data structure is the same as H01. Valid only if CompetingRisk = TRUE.

Sig

the variance-covariance matrix of the random effects.

sigma

the variance of the measurement error for the linear mixed effects model.

iter

the total number of iterations until convergence.

convergence

convergence identifier: 1 corresponds to successful convergence, whereas 0 to a problem (i.e., when 0, usually more iterations are required).

vcov

the variance-covariance matrix of all the fixed effects for both models.

sebeta

the standard error of beta.

segamma1

the standard error of gamma1.

segamma2

the standard error of gamma2. Valid only if CompetingRisk = TRUE.

senu1

the standard error of nu1.

senu2

the standard error of nu2. Valid only if CompetingRisk = TRUE.

seSig

the vector of standard errors of covariance of random effects.

sesigma

the standard error of variance of measurement error for the linear mixed effects model.

loglike

the log-likelihood value.

fitted

a list with the fitted values:

resid

the vector of estimated residuals for the linear mixed effects model.

fitted

the vector of fitted values for the linear mixed effects model.

fittedmar

the vector of marginal fitted values for the linear mixed effects model.

residmar

the vector of estimated marginal residuals for the linear mixed effects model.

fittedSurv

the estimated survival rate evaluated at each uncensored event time.

FUNB

the estimated random effects for each subject.

CompetingRisk

logical value; TRUE if a competing event are accounted for.

quadpoint

the number of Gauss Hermite quadrature points used for numerical integration.

ydata

the input longitudinal dataset for fitting a joint model. It has been re-ordered in accordance with descending observation times in cdata.

cdata

the input survival dataset for fitting a joint model. It has been re-ordered in accordance with descending observation times.

PropEventType

a frequency table of number of events.

LongitudinalSubmodel

the component of the long.formula.

SurvivalSubmodel

the component of the surv.formula.

random

the component of the random.

tol

the convergence parameter.

call

the matched call.

Quad.method

the quadrature rule used for integration. If pseudo-adaptive quadrature rule is used, then return pseudo-adaptive. Otherwise return standard.

id

the grouping vector for the longitudinal outcome.

Arguments

ydata

A longitudinal data frame in long format.

cdata

A survival data frame with one row per subject, containing the survival time, event indicator, and baseline covariates.

long.formula

A formula object specifying the response variable and fixed-effect covariates in the longitudinal submodel.

random

A one-sided formula object specifying the random-effects structure in the longitudinal submodel. For example, a random-intercept model can be specified as ~ 1 | ID, and a random-intercept and random-slope model can be specified as ~ x1 + ... + xn | ID.

surv.formula

A formula object specifying the survival time, event indicator, and covariates in the survival submodel.

control

A list of fitting-control options, typically generated by jmcs_control(). Available options include:

quadpoint

Number of pseudo-adaptive or standard Gauss--Hermite quadrature points used for numerical integration. The default is 6.

maxiter

Maximum number of EM iterations. The default is 10000.

verbose

Logical value indicating whether to print detailed information at each iteration. The default is FALSE.

initial.para

Optional list of user-supplied initial parameter values for the EM algorithm. The default is NULL.

tol

Convergence tolerance for the EM algorithm. The default is 1e-4.

method

Numerical integration method used in the E-step. Available options are "pseudo-adaptive" and "standard". The default is "pseudo-adaptive".

opt

Optimization method used to fit the initial linear mixed-effects model. Available options are "nlminb" and "optim". The default is "nlminb".

Author

Shanpeng Li lishanpeng0913@ucla.edu

See Also

ranef, fixef, fitted.jmcs, residuals.jmcs, survfitjmcs, plot.jmcs, vcov.jmcs

Examples

Run this code

require(FastJM)
require(survival)
# Load a simulated longitudinal dataset
data(ydata)
# Load a simulated survival dataset with two competing events
data(cdata)
# \donttest{
# Fit a joint model
fit <- jmcs(ydata = ydata, cdata = cdata, 
            long.formula = response ~ time + gender + x1 + race, 
            surv.formula = Surv(surv, failure_type) ~ x1 + gender + x2 + race, 
            random =  ~ time| ID)
fit
# Extract the parameter estimates of longitudinal sub-model fixed effects
fixef(fit, process = "Longitudinal")
# Extract the parameter estimates of survival sub-model fixed effects
fixef(fit, process = "Event")
# Obtain the random effects estimates for first 6 subjects 
head(ranef(fit))
# Obtain the variance-covariance matrix of all parameter estimates 
vcov(fit)
# Obtain the result summaries of the joint model fit
summary(fit, process = "Longitudinal")
summary(fit, process = "Event")
# Prediction of cumulative incidence for competing risks data
# Predict the conditional probabilities for two patients who are alive (censored)
ND <- ydata[ydata$ID %in% c(419, 218), ]
ID <- unique(ND$ID)
NDc <- cdata[cdata$ID  %in% ID, ]
survfit <- survfitJM(fit, 
                     ynewdata = ND, 
                     cnewdata = NDc, 
                     u = seq(3, 4.8, by = 0.2), 
                     method = "GH",
                     obs.time = "time")
survfit

res <- DynPredAcc(object = fit,
                  landmark.time = 3,
                  horizon.time = c(3.6, 4, 4.4),
                  obs.time = "time",
                  method = "GH",
                  maxiter = 1000,
                  n.cv = 3,
                  metrics = c("AUC", "Cindex", "Brier Score", "MAE", "MAEQ"))

# Print all available evaluation metrics for the fitted joint model
summary(res, metric = "Brier Score")
summary(res, metric = "MAE")
summary(res, metric = "MAEQ")
summary(res, metric = "AUC")
summary(res, metric = "Cindex")

# }

Run the code above in your browser using DataLab