relaxo                package:relaxo                R Documentation

_R_e_l_a_x_e_d _L_a_s_s_o (_r_e_l_a_x_o)

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

     Computes all "Relaxed Lasso" solutions.

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

     relaxo(X, Y, phi = seq(0, 1, length = 4), max.steps = min(2*length(Y), 2 * ncol(X)), fast = TRUE,  keep.data = TRUE, warn=TRUE)

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

       X: n x p-dimensional matrix or data frame containing the
          predictor variables; columns are supposed to be scaled and
          centered. 

       Y: n-dimensional numerical response vector; supposed to be
          centered to mean 0.  

     phi: Relaxation parameter in [0,1]. A value of phi=1 corresponds
          to the regular Lasso solutions; a value of phi=0 computes the
          OLS estimates on the set of variables selected by the Lasso.  

max.steps: Maximal number of steps the LARS algorithm is run. 

    fast: Should the estimates be computed in approx. the same time as
          the LARS algorithm? If fast=TRUE, minor deviations from the
          original Relaxed Lasso solution can occur. 

keep.data: Should the data be kept for later usage e.g. (when computing
          predicted values for the training data) ?  

    warn: If TRUE, warnings are given if the predictor variables X are
          not centered and scaled or if the reponse variable is not
          centered) ?  

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

     An object of class 'relaxo', for which plot and predict methods
     are available.

_A_u_t_h_o_r(_s):

     Nicolai Meinshausen nicolai@stat.berkeley.edu

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

     N. Meinshausen, "Relaxed Lasso", Computational Statistics and Data
     Analysis, to appear. <URL: http://www.stat.berkeley.edu/~nicolai>

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

     See also  'cvrelaxo' for computation of the cross-validated
     solution with optimal predictive performance

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

             data(diabetes)

     ## Center and scale variables
             x <- scale(diabetes$x)
             y <- scale(diabetes$y)
             
     ## Compute "Relaxed Lasso" solution and plot results
             object <- relaxo(x,y)
             plot(object)   
             
     ## Compute cross-validated solution with optimal 
     ## predictive performance and print relaxation parameter phi and 
     ## penalty parameter lambda of the found solution
             cvobject <- cvrelaxo(x,y)
             print(cvobject$phi)
             print(cvobject$lambda)

     ## Compute fitted values and plot them versus actual values     
             fitted.values <- predict(cvobject)
             plot(fitted.values,y)
             abline(c(0,1))

