powered by
Find an optimal submodel
RegBest(y,x, int = TRUE, wt=NULL, na.action = na.omit, method=c("r2","Cp", "adjr2"), nbest=1)
Returns the objects
gives all the nbest best models for a given number of variables
nbest
the best model
A response vector
A matrix of predictors
Add an intercept to the model
Optional weight vector
Handling missing values
Calculate R-squared, adjusted R-squared or Cp to select the model. By default a the F-test on the r-square is used
number of best models for each set of explained variables (by default 1)
Francois Husson francois.husson@institut-agro.fr
lm
data(milk) res = RegBest(y=milk[,6],x=milk[,-6]) res$best
Run the code above in your browser using DataLab