Cox regression via penalized maximum likelihood using C++ engine
coxnet.RdThis function calls the C++ implementation of Cox regression with elastic net regularization. It handles both right-censored and left-truncated (start, stop) survival data using the Breslow or Efron method for ties. For stratified Cox models, it uses an IRLS approach with integrated C++ gradient/Hessian computation.
Usage
coxnet(
x,
is.sparse,
y,
weights,
offset,
alpha,
nobs,
nvars,
jd,
vp,
cl,
ne,
nx,
nlam,
flmin,
ulam,
thresh,
isd,
vnames,
maxit,
pb,
efron = FALSE
)Arguments
- x
Design matrix, of dimension nobs x nvars.
- is.sparse
Logical, is x a sparse matrix?
- y
Survival response variable, must be a Surv or stratifySurv object.
- weights
Observation weights.
- offset
Offset for the linear predictor.
- alpha
The elastic net mixing parameter.
- nobs
Number of observations.
- nvars
Number of variables.
- jd
Excluded variable indices (1-indexed, first element is count).
- vp
Penalty factors for each coefficient.
- cl
Coefficient limits matrix (2 x nvars).
- ne
Maximum number of variables in the model.
- nx
Maximum number of variables ever to be nonzero.
- nlam
Number of lambda values.
- flmin
Minimum lambda ratio.
- ulam
User-supplied lambda sequence.
- thresh
Convergence threshold.
- isd
Standardize flag.
- vnames
Variable names.
- maxit
Maximum number of iterations.
- pb
Progress bar object.
- efron
Logical; if TRUE use Efron method for ties, otherwise Breslow.
Value
An object of class "coxnet" with components:
- a0
NULL (Cox model has no intercept)
- beta
Sparse coefficient matrix
- df
Number of nonzero coefficients per lambda
- dim
Dimension of coefficient matrix
- lambda
Lambda sequence used
- dev.ratio
Fraction of null deviance explained
- nulldev
Null deviance
- npasses
Number of coordinate descent passes
- jerr
Error code
- offset
Logical indicating if offset was used