step.gam                package:mgcv                R Documentation

_A_l_t_e_r_n_a_t_i_v_e_s _t_o _s_t_e_p._g_a_m

_D_e_s_c_r_i_p_t_i_o_n:

     There is no 'step.gam' in package 'mgcv'. The 'mgcv' default for
     model selection is to use either prediction error criteria such as
      GCV, GACV, Mallows' Cp/AIC/UBRE or the likelihood based methods
     of REML or ML.  Since the  smoothness estimation part of model
     selection is done in this way it is logically most consistent to
     perform the rest of model selection in the same way. i.e. to
     decide which terms to include or omit by looking at changes in
     GCV, AIC, REML etc. 

     To facilitate fully automatic model selection the package
     implements two smooth modification techniques which can be used to
     allow smooths to be shrunk to zero as  part of smoothness
     selection.


     _S_h_r_i_n_k_a_g_e _s_m_o_o_t_h_e_r_s are smoothers in which a small multiple of the
          identity matrix is added to the smoothing penalty, so that
          strong enough penalization will shrink all the  coefficients
          of the smooth to zero. Such smoothers can effectively be
          penalized out of the  model altogether, as part of smoothing
          parameter estimation. 2 classes of these shrinkage smoothers
          are implemented: '"cs"' and '"ts"', based on  cubic
          regression spline and thin plate regression spline smoothers
          (see 's')  

     _N_u_l_l _s_p_a_c_e _p_e_n_a_l_i_z_a_t_i_o_n An alternative is to construct an extra
          penalty for each  smooth which penalizes the space of
          functions of zero wiggliness according to its existing
          penalties. If all the smoothing parameters for such a term
          tend to infinity then the term is penalized to zero,  and is
          effectively dropped from the model. The advantage of this
          approach is that it can be  implemented automatically for any
          smooth. The 'select' argument to 'gam' causes  this latter
          approach to be used.

     REML and ML smoothness selection are equivalent under this
     approach, and simulation evidence suggests  that they tend to
     perform a little better than prediction error criteria, for model
     selection.

_A_u_t_h_o_r(_s):

     Simon N. Wood simon.wood@r-project.org

_S_e_e _A_l_s_o:

     'gam.selection'

_E_x_a_m_p_l_e_s:

     ## an example of GCV based model selection as
     ## an alternative to stepwise selection, using
     ## shrinkage smoothers...
     library(mgcv)
     set.seed(0);n <- 400
     dat <- gamSim(1,n=n,scale=2)
     dat$x4 <- runif(n, 0, 1)
     dat$x5 <- runif(n, 0, 1)
     attach(dat)
     ## Note the increased gamma parameter below to favour
     ## slightly smoother models...
     b<-gam(y~s(x0,bs="ts")+s(x1,bs="ts")+s(x2,bs="ts")+
        s(x3,bs="ts")+s(x4,bs="ts")+s(x5,bs="ts"),gamma=1.4)
     summary(b)
     plot(b,pages=1)

     ## Same again using REML/ML
     b<-gam(y~s(x0,bs="ts")+s(x1,bs="ts")+s(x2,bs="ts")+
        s(x3,bs="ts")+s(x4,bs="ts")+s(x5,bs="ts"),method="REML")
     summary(b)
     plot(b,pages=1)

     ## And once more, but using the null space penalization
     b<-gam(y~s(x0,bs="cr")+s(x1,bs="cr")+s(x2,bs="cr")+
        s(x3,bs="cr")+s(x4,bs="cr")+s(x5,bs="cr"),
        method="REML",select=TRUE)
     summary(b)
     plot(b,pages=1)

     detach(dat);rm(dat)

