Cox Proportional Hazards Model with Mahalanobis Distance Transfer Learning
cox_MDTL.RdFits a Cox proportional hazards model incorporating external information via a
Mahalanobis distance penalty. This approach penalizes the deviation of the
estimated coefficients from external reference coefficients (beta),
weighted by a specified matrix (typically the inverse covariance matrix).
Usage
cox_MDTL(
z,
delta,
time,
stratum = NULL,
beta,
vcov = NULL,
etas,
tol = 1e-04,
Mstop = 50,
backtrack = FALSE,
message = FALSE,
data_sorted = FALSE,
beta_initial = NULL
)Arguments
- z
A numeric matrix or data frame of covariates (n x p).
- delta
A numeric vector of event indicators (1 = event, 0 = censored).
- time
A numeric vector of observed times.
- stratum
Optional numeric or factor vector indicating strata. If
NULL, all subjects are assumed to be in the same stratum.- beta
A numeric vector of external coefficients (length p).
- vcov
Optional numeric matrix (p x p) acting as the weighting matrix \(Q\) in the Mahalanobis penalty. Note: In standard Mahalanobis distance formulations, this should be the inverse of the covariance matrix (precision matrix). If not provided, an identity matrix is used.
- etas
A numeric vector of tuning parameters (scalars) to evaluate.
- tol
Convergence tolerance for the Newton-Raphson algorithm. Default is 1e-4.
- Mstop
Maximum number of iterations for Newton-Raphson. Default is 50.
- backtrack
Logical. If
TRUE, uses backtracking line search. Default isFALSE.- message
Logical. If
TRUE, progress messages are printed.- data_sorted
Logical. If
TRUE, assumes input data is already sorted by stratum and time.- beta_initial
Optional initial coefficient vector for warm start.
Value
An object of class "Cox_MDTL" containing:
etaThe vector of eta values evaluated.
betaA matrix of estimated coefficients (p x n_eta).
linear.predictorsA matrix of linear predictors (n x n_eta).
likelihoodA vector of log-partial likelihoods for each eta.
dataA list containing the input data used.
Details
The objective function minimizes the negative log-partial likelihood plus a penalty term: $$P(\beta) = \frac{\eta}{2} (\beta - \beta_{ext})^T Q (\beta - \beta_{ext})$$ where:
\(\beta_{ext}\) is the vector of external coefficients.
\(Q\) is the weighting matrix (derived from
vcov).\(\eta\) is the tuning parameter controlling the strength of the external information.
If vcov is NULL, \(Q\) defaults to the identity matrix, reducing the
penalty to a standard Euclidean distance (Ridge-type shrinkage towards beta).
Examples
if (FALSE) { # \dontrun{
data(ExampleData_lowdim)
train_dat_lowdim <- ExampleData_lowdim$train
beta_external_lowdim <- ExampleData_lowdim$beta_external_fair
eta_list <- generate_eta(method = "exponential", n = 50, max_eta = 5)
cox_MDTL_est <- cox_MDTL(
z = train_dat_lowdim$z,
delta = train_dat_lowdim$status,
time = train_dat_lowdim$time,
beta = beta_external_lowdim,
vcov = NULL,
etas = eta_list
)
} # }