BestSubsets(OptReg) | R Documentation |
Select the best subsets for each size by regsubsets.
BestSubsets(Xy=Xy,intercept=TRUE,nbest=1,method=c("exhaustive", "backward", "forward", "seqrep"), verbose = FALSE)
Xy |
Dataframe containing the design matrix X and the output variable y. All columns must be named. |
intercept |
If the value is TRUE, include the term of intercept. If FALSE, no intercept. |
nbest |
The number of best subsets for each size. Now we only consider nbest=1. |
method |
Method used to search the best subsets. |
verbose |
TRUE, print extra information. FALSE, silent. |
It is a matrix consisting of TRUE or FALSE. Each row is a best subset.
# Hospital manpower data data(manpower) Xy=data.frame(x0=rep(1,nrow(manpower)),manpower[,-1]) colnames(Xy)=c(paste("x",0:(ncol(Xy)-2),sep=""),"y") subsets=BestSubsets(Xy,intercept=FALSE) subsets