leaps                 package:leaps                 R Documentation

_a_l_l-_s_u_b_s_e_t_s _r_e_g_r_e_s_s_i_o_m

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

     leaps() performs an exhaustive search for the best subsets of the
     variables in x for predicting y in linear regression, using an
     efficient branch-and-bound algorithm.  It is a compatibility
     wrapper for `regsubsets' does the same thing better.

_U_s_a_g_e:

     leaps(x=, y=, wt=rep(1, NROW(x)), int=TRUE, method=c("Cp", "adjr2", "r2"), nbest=10, names=NULL, df=NROW(x), strictly.compatible=T)

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

       x: A matrix of predictors

       y: A response vector

      wt: Optional weight vector

     int: Add an intercept to the model

  method: Calculate Cp, adjusted R-squared or R-squared

   nbest: Number of subsets of each size to report

   names: vector of names for columns of `x'

      df: Total degrees of freedom to use instead of `nrow(x)' in
          calculating Cp and adjusted R-squared

strictly.compatible: Implement misfeatures of leaps() in S

_V_a_l_u_e:

     A list with components 

   which: logical matrix. Each row can be used to select the columns of
          `x' in the respective model

    size: Number of variables, including intercept if any, in the model

      cp: or `adjr2' or `r2' is the value of the chosen model
          selectionstatistic for each model

   label: vector of names for the columns of x

_N_o_t_e:

     With `strictly.compatible=T' the function will stop with an error
     if `x' is not of full rank or if it has more than 31 columns. It
     will ignore the column names of `x' even if `names==NULL' and will
     replace them with "0" to "9", "A" to "Z".

_R_e_f_e_r_e_n_c_e_s:

     Alan Miller "Subset Selection in Regression" Chapman & Hall

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

     `regsubsets', `regsubsets.formula', `regsubsets.default'

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

     x<-matrix(rnorm(100),ncol=4)
     y<-rnorm(25)
     leaps(x,y)

