MTAFT_CV {MTAFT} | R Documentation |
MTAFT_CV: Cross-Validation for Multiple Thresholds Accelerated Failure Time Model
Description
This function implements a cross-validation method for the multiple thresholds accelerated failure time (AFT) model using either the "WBS" (Wild Binary Segmentation) or "DP" (Dynamic Programming) algorithm. It determines the optimal number of thresholds by evaluating the cross-validation (CV) values.
Usage
MTAFT_CV(
Y,
X,
delta,
Tq,
algorithm,
dist_min = 50,
ncps_max = 4,
wbs_nintervals = 200
)
Arguments
Y |
the censored logarithm of the failure time. |
X |
the design matrix without the intercept. |
delta |
the censoring indicator. |
Tq |
the threshold values. |
algorithm |
the threshold detection algorithm, either "WBS" or "DP". |
dist_min |
the pre-specified minimal number of observations within each subgroup. Default is 50. |
ncps_max |
the pre-specified maximum number of thresholds. Default is 4. |
wbs_nintervals |
the number of random intervals in the WBS algorithm. Default is 200. |
Value
A list with the following components:
- params
the subgroup-specific slope estimates and variance estimates.
- thres
the threshold estimates.
- CV_vals
the CV values for all candidate number of thresholds.
Examples
# Generate simulated data with 500 samples and normal error distribution
dataset <- MTAFT_simdata(n = 500, err = "normal")
Y <- dataset[, 1]
delta <- dataset[, 2]
Tq <- dataset[, 3]
X <- dataset[, -c(1:3)]
# Run mAFT_CV with WBS algorithm
maft_cv_result <- MTAFT_CV(Y, X, delta, Tq, algorithm = "WBS")
maft_cv_result$params
maft_cv_result$thres
maft_cv_result$CV_vals