Perform K-Fold Cross Validation
kfold_cross_validation(
data,
formula,
model_function,
predict_function = predict,
metric_function = NULL,
k = 5,
seed = NULL,
...
)A list containing fold results and summary statistics
A data frame containing the dataset
A formula specifying the model (e.g., y ~ x1 + x2)
Function to fit the model (e.g., lm, glm)
Function to make predictions (default: predict)
Function to calculate performance metric
Number of folds (default: 5)
Random seed for reproducibility (optional)
Additional arguments passed to model_function