Cross-validated Z-residuals for Shared Frailty Cox Models
Source:R/CV.Zresidual.coxph.survival.R
CV_Zresidual_coxph_frailty_survival.RdInternal function to compute cross-validated Z-residuals for shared frailty Cox proportional hazards models.
Arguments
- fit.coxph
A fitted
survival::coxphmodel object containing a frailty term.- data
Optional data frame containing the data. Required if the original model was fit without specifying the
dataargument or iffoldlistis supplied.- nfolds
Integer. Number of folds for cross-validation (K in K-fold CV).
- foldlist
Optional list specifying custom fold assignments.
- n.rep
Integer. Number of repeated cross-validations.
- ...
Additional arguments.
Value
A matrix containing the cross-validated Z-residuals (\(N \times nrep\)) with
diagnostic attributes: Survival.Prob, linear.pred,
censored.status, covariates, and object.model.frame.
Details
This function implements the K-fold cross-validation procedure specifically
for shared frailty Cox models (i.e., those containing a frailty() term).
In each fold, the model is refitted on the training data, and the Z-residuals
are calculated on the held-out test data.