

subsets(leaps)                               R Documentation

_f_u_n_c_t_i_o_n_s _f_o_r _s_u_b_s_e_t _s_e_l_e_c_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n_:

     Generic function for regression subset selection with
     methods for formula and matrix arguments.

_U_s_a_g_e_:

     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)

     summary.subsets(ll,all.best=TRUE,matrix=T,matrix.logical=F,df=NULL)

_A_r_g_u_m_e_n_t_s_:

 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 perform exhaustive search on more
          than 50 variables.

      ll: subsets object

all.best: Show all the best subsets or just one of each size

  matrix: Show a matrix of the variables in each model or
          just summary statistics

matrix.logical: With `matrix=TRUE', the matrix is logical
          `TRUE'/`FALSE' or string `"*"'/code{" "}

      df: Specify a number of degrees of freedom for the
          summary statistics. The default is `n-1'

_V_a_l_u_e_:

     An object of class "subsets" containing no user-ser-
     viceable parts. It is designed to be processed by `sum-
     mary.subsets'.

_N_o_t_e_:

     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 consid-
     erably. There is no hard-coded limit to the number of
     variables.

_S_e_e _A_l_s_o_:

     `leaps'

_E_x_a_m_p_l_e_s_:

     data(swiss)
     a<-subsets(as.matrix(swiss[,-1]),swiss[,1])
     summary(a)
     b<-subsets(Fertility~.,data=swiss)
     summary(a)

