View source: R/3_kfold_split.R
| kfold_split | R Documentation |
Splits input data into k folds for cross-validation, generating training and test sets for each fold. Particularly useful for mediator selection stability assessment in high-dimensional mediation analysis.
kfold_split(data, kfold = 3)
data |
A data frame or matrix containing the dataset to be split. Rows represent observations, columns represent variables. |
kfold |
Integer (default: 3). Number of folds for cross-validation. Must be >= 2 and <= nrow(data). |
A list containing two elements:
train_set: List of length kfold, each element is a training subset
test_set: List of length kfold, each element is the corresponding test subset
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.