Specify which fold each observation is in to obtain foldid.
coxsplit randomly split data. coxsplity splits data by the `status' of y, and within each status, data is randomly split. coxsplitw splits data in the order of w.
Usage
coxsplit(y, nfolds)
coxsplity(y, nfolds)
coxsplitw(w, nfolds)
Arguments
y
response variable. y should be a two-column matrix with columns named `time' and `status'. The latter is a binary variable, with `1' indicating event, and `0' indicating right censored.
w
input vector, same length as y. The coefficients vary with w.
nfolds
number of folds.
Value
a vector of values between 1 and nfolds specifying which fold each observation is in.
Details
By default, coxsplit is incorporated in Coxnet and coxsplitw in loCoxnet. To use other data splitting method, generate foldid at the outset and supply it as an augment in Coxnet and loCoxnet.