getBestModel: Get the best model with nvar variables, or by AIC, BIC or knee-point.
Description
Returns a binary vector of variables for the best model, as defined by either the AIC, BIC, or knee-point, or alternatively the best for a given number of variables.
Number of variables for the best model. Only used if method is mse or NULL. Can be omitted if method is named and is AIC, BIC or knee.
method
The desired metric for defining the best model. If nvar is omitted, method must be named.
Value
A binary vector of the variables in the best model.
Details
The methods AIC, BIC and knee look at the whole set of tried models, whereas mse or NULL means that the function looks for the best model with nvar variables and the lowest mean square error.