我正在尝试对数据集进行向后逐步逻辑回归。但是我不确定如何在函数中指定它。这是我的代码:
library(caret)
# Set seed for reproducibility
set.seed(123)
# Set up repeated k-fold cross-validation
train.control <- trainControl(method = "cv", number = 10)
# Train the model
step.model <- train(Preg1 ~., data = dfp,
method = "glm",
family=binomial(),
trControl = train.control
)
有人知道怎么做吗?任何帮助将不胜感激。谢谢。