This function allows you to fit a model between dependend and independend variables and calculate various selection routines.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | rg_fit_model(
predictors,
response,
method = "lm",
ctrl = caret::trainControl(),
subset = "full",
preProc = c("center", "scale"),
metric = ifelse(is.factor(response), "Accuracy", "RMSE"),
maximize = ifelse(metric == "RMSE", FALSE, TRUE),
tuneLength = 3,
tuneGrid = NULL,
verbose = T,
withinSE = FALSE,
minVar = 2,
...
)
|
predictors |
a data.frame with the predictor variables as columns |
response |
a vector with the response variable |
method |
string, type of statistical model for more details see caret::train() |
ctrl |
trainControl object |
subset |
string, subset selection routine that should be carried out. One of full, best, rfe or ffs |
preProc |
string or vector, pre processing routines that should be applied to predictors |
metric |
string, performance metric that is used to select the best model, defaults to RMSE for numeric and Accuracy for factor response |
maximize |
string, should metric be maximized? |
tuneLength |
numeric, see caret::train() for more details |
tuneGrid |
see caret::train() for more details |
withinSE |
Logical Models are only selected if they are better than the currently best models Standard error |
minVar |
Numeric. Number of variables to combine for the first selection |
... |
further arguments passed on to caret::train() |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.