contrastMatrix          package:ArrayTools          R Documentation

_C_l_a_s_s _t_o _C_o_n_t_a_i_n _t_h_e _C_o_n_t_r_a_s_t _M_a_t_r_i_x _t_h_a_t _U_s_e_d _f_o_r _L_i_n_e_a_r _R_e_g_r_e_s_s_i_o_n

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

     Class to Contain the Contrast Matrix that Used for Linear
     Regression, inherited from the designMatrix class

_C_r_e_a_t_i_n_g _O_b_j_e_c_t_s:

     'new("contrastMatrix", ...,  design.matrix=[designMatrix], 
     compare1=[character],  compare2=[character],  level=[character],
     interaction==[numeric])'.

     This creates a contrast matrix class. 'design.matrix' is a
     'designMatrix' class.  'compare1' the first value of the main
     covariate, and 'compare2' is the second value of the main
     covariate.   For example, suppose that the main covariate is
     "drug", and there  are three unique values: "drug1", "drug2", and
     "placebo".  You would like to compare "drug1" to "drug2". Then you
     would use "drug1" as  'compare1' and "drug2" as 'compare2'.  If
     'interaction==TRUE',  do not specify 'compare1' and 'compare2'. 
     You only specify  'level' when the design matrix contains an
     interaction term.  Suppose that you would like to compare "drug1"
     to "drug2" only when estrogen is  "present", where "present" is
     one of the values of the estrogen variable.  You will use
     "present" as level. If 'interaction==TRUE', do not specify this 
     value as well.  You only specify 'interaction=TRUE' when you would
     like to  detect the interaction effect between two covariates. In
     this case, do not provide values for 'compare1', 'compare2', and
     'level'

_S_l_o_t_s:


     '_c_o_n_t_r_a_s_t': Object of class '"matrix"' contains the contrast
          matrix

     '_c_o_m_p_a_r_e_1': Object of class '"character"' contains 'compare1'

     '_c_o_m_p_a_r_e_2': Object of class '"character"' contains 'compare2' 

     '_l_e_v_e_l': Object of class '"character"' contains 'level' 

     '_i_n_t_e_r_a_c_t_i_o_n': Object of class '"logical"' contains 'interaction'

     '_d_e_s_i_g_n': Object of class '"matrix"' contain the design matrix

     '_t_a_r_g_e_t': Object of class '"data.frame"' contains 'target'

     '_c_o_v_a_r_i_a_t_e_s': Object of class '"character"' contains 'covariates'

     '_i_n_t_I_n_d_e_x': Object of class '"numeric"' contains 'intIndex' 

_E_x_t_e_n_d_s:

     Class '"designMatrix"', directly.

_M_e_t_h_o_d_s:


     _g_e_t_C_o_m_p_a_r_e_1 'signature(object = "contrastMatrix")':  access the
          'compare1' slot

     _g_e_t_C_o_m_p_a_r_e_2 'signature(object = "contrastMatrix")':  access the
          'compare2' slot

     _g_e_t_C_o_n_t_r_a_s_t 'signature(object = "contrastMatrix")':  access the
          'contrast' slot 

     _g_e_t_I_n_t_e_r_a_c_t_i_o_n 'signature(object = "contrastMatrix")':  access the
          'interaction' slot

     _g_e_t_L_e_v_e_l 'signature(object = "contrastMatrix")':  access the
          'level' slot 

     _i_n_i_t_i_a_l_i_z_e 'signature(.Object = "contrastMatrix")':  create a new
          contrast matrix class 

     _s_h_o_w 'signature(object = "contrastMatrix")': print the contrast
          matrix 

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

     Xiwei Wu, Arthur Li

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

     'designMatrix'

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

     data(eSetExample)
     ## One-way Anova
     (design1<- new("designMatrix", target=pData(eSetExample), covariates = "Treatment"))
     (contrast1<- new("contrastMatrix", design.matrix = design1, 
         compare1 = "Treated", compare2 = "Control"))
             
     ## Randomized block design
     (design2<- new("designMatrix", target=pData(eSetExample), 
        covariates = c("Treatment", "Group")))
     (contrast2<- new("contrastMatrix", design.matrix = design2, 
         compare1 = "Treated", compare2 = "Control"))

     ## Interaction design
     (design3<- new("designMatrix", target=pData(eSetExample), 
        covariates = c("Treatment", "Group"), intIndex=c(1,2)))
     # Test for interaction:
     (contrast.int<- new("contrastMatrix", design.matrix = design3,
         interaction=TRUE))
     # Compare Treated vs Control among group A
     (contrast.a<- new("contrastMatrix", design.matrix = design3, 
         compare1 = "Treated", compare2 = "Control", level="A"))

