functions for subset selection
Usage
subsets(x=, ...)
subsets.formula(formula=, data=, weights=rep(1, length(y)), nbest=1, nvmax=8, force.in=NULL, force.out=NULL, intercept=T, method=c("exhaustive", "backward", "forward", "seqrep"), really.big=F)
subsets.default(x=, y=, weights=rep(1, length(y)), nbest=1, nvmax=8, force.in=NULL, force.out=NULL, intercept=T, method=c("exhaustive", "backward", "forward", "seqrep"), really.big=F)
Arguments
formula
|
model formula for full model
|
data
|
Optional data frame
|
x
|
design matrix with all predictors
|
y
|
response vector
|
weights
|
weight vector
|
nbest
|
number of subsets of each size to record
|
nvmax
|
maximum size of subsets to examine
|
force.in
|
index to columns of design matrix that should be in all models
|
force.out
|
index to columns of design matrix that should be in no models
|
intercept
|
Add an intercept?
|
method
|
Use exhaustive search, forward selection, backward selection or sequential replacement to search.
|
really.big
|
Must be T to performe exhaustive search on more than 50 variables.
|
Description
Generic function for regression subset selection with methods for formula and matrix arguments.Value
An object of class "leaps" containing no user-serviceable parts. It is designed to be processed by summary.leaps
. If you want to understand the components of this object then read the source.Note
This function improves on leaps()
in several ways. The design matrix need not be of full rank. The ability to restrict nvmax
speeds up exhaustive searches considerably. There is no hard-coded limit to the number of variables.See Also
leaps()
, summary.leaps
Examples
data(swiss)
a<-subsets(as.matrix(swiss[,-1]),swiss[,1])
b<-summary(a)