BestSubsets(OptReg)R Documentation

Find the best subset by regsubsets in leaps.

Description

Select the best subsets for each size by regsubsets.

Usage

BestSubsets(Xy=Xy,intercept=TRUE,nbest=1,method=c("exhaustive", "backward", "forward", "seqrep"), verbose = FALSE)

Arguments

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.

Value

It is a matrix consisting of TRUE or FALSE. Each row is a best subset.

See Also

lm, leaps

Examples

# 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

[Package OptReg version 4.0 Index]