pamr.decorrelate            package:pamr            R Documentation

_A _f_u_n_c_t_i_o_n _t_o _d_e_c_o_r_r_e_l_a_t_e (_a_d_j_u_s_t) _t_h_e _f_e_a_t_u_r_e _m_a_t_r_i_x _w_i_t_h _r_e_s_p_e_c_t
_t_o _s_o_m_e _a_d_d_i_t_i_o_n_a_l _p_r_e_d_i_c_t_o_r_s

_D_e_s_c_r_i_p_t_i_o_n:

     A function to decorrelate (adjust) the feature matrix with respect
     to some additional predictors

_U_s_a_g_e:

      pamr.decorrelate(x, adjusting.predictors, xtest=NULL, adjusting.predictors.test=NULL)

_A_r_g_u_m_e_n_t_s:

       x: Matrix of training set feature values,  with genes in the
          rows, samples in the columns

adjusting.predictors: List of training set predictors to be used for
          adjustment

   xtest: Optional matrix of test set feature values, to be adjusted in
          the same way as the training set

adjusting.predictors.test: Optional list of test set predictors to be
          used for adjustment

_D_e_t_a_i_l_s:

     'pamr.decorrelate' Does a least squares regression of each row of
     x on the adjusting predictors, and returns the residuals. If xtest
     is provided, it also returns the adjusted version of  xtest, using
     the training set  least squares regression model for adjustment

_V_a_l_u_e:

     A list with components 

   x.adj: Adjusted x matrix

xtest.adj: Adjusted xtest matrix, if xtest we provided

_A_u_t_h_o_r(_s):

     Trevor Hastie,Robert Tibshirani, Balasubramanian Narasimhan, and
     Gilbert Chu

_R_e_f_e_r_e_n_c_e_s:

     Robert Tibshirani, Trevor Hastie, Balasubramanian Narasimhan, and
     Gilbert Chu  Diagnosis of multiple cancer types by shrunken
     centroids of gene expression  PNAS 99: 6567-6572.   Available at
     www.pnas.org

_E_x_a_m_p_l_e_s:

     #generate some data
     set.seed(120)

     x<-matrix(rnorm(1000*20),ncol=20)
     y<-c(rep(1,10),rep(2,10))
     adjusting.predictors=list(pred1=rnorm(20), pred2=as.factor(sample(c(1,2),replace
     =TRUE,size=20)))
     xtest=matrix(rnorm(1000*10),ncol=10)
     adjusting.predictors.test=list(pred1=rnorm(10), pred2=as.factor(sample(c(1,2),replace
     =TRUE,size=10)))

     # decorrelate training x wrt adjusting predictors

     x.adj=pamr.decorrelate(x,adjusting.predictors)$x.adj
     # train classifier with adjusted x

     d=list(x=x.adj,y=y)
     a<-pamr.train(d)

     # decorrelate training and test x wrt adjusting predictors, then make
     #predictions for test set

     temp<-pamr.decorrelate(x,adjusting.predictors, xtest=xtest, adjusting.predictors.test=adjusting.predictors.test)

     d=list(x=temp$x.adj,y=y)
     a<-pamr.train(d)
     aa<-pamr.predict(a,temp$xtest.adj, threshold=.5)

