Skip to contents

Internal function to compute cross-validated Z-residuals for standard Cox proportional hazards models (without frailty).

Usage

CV_Zresidual_coxph_survival(fit.coxph, data, nfolds, foldlist, n.rep, ...)

Arguments

fit.coxph

A fitted survival::coxph model object.

data

Optional data frame containing the data. Required if the original model was fit without specifying the data argument or if foldlist is 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. In each fold, the Cox model is refitted on the training data, and the Z-residuals are calculated on the held-out test data. This approach is for models without shared frailty terms.