contrasts             package:factDesign             R Documentation

_C_o_n_s_t_r_u_c_t _a_p_p_r_o_p_r_i_a_t_e _l_a_m_b_d_a _m_a_t_r_i_x _a_n_d _t_e_s_t _l_i_n_e_a_r _c_o_n_t_r_a_s_t_s _o_f _t_h_e _p_a_r_a_m_e_t_e_r _e_s_t_i_m_a_t_e_s _f_r_o_m _a _l_i_n_e_a_r _m_o_d_e_l.

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

     'par2lambda' takes list of lm coefficient names and a
     corresponding list of numeric vectors corresponding to hypothesis
     tests of linear contrasts and returns a lambda matrix suitable for
     an F-test of the linear contrasts.  'par2lambda' is intended to be
     used in conjunction with 'contrastTest' or 'findFC'.

     'contrastTest' performs an F test for simultaneous tests of linear
     contrasts using an appropriately specified lambda matrix and an lm
     object.

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

     par2lambda(betaNames, betas, coefs)
     contrastTest(model, lambda, cVec = NA, p = 0.01)

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

betaNames: A character vector of the names of the coefficients in a
          linear model. 

   betas: A list of vectors of the parameters to be used in the
          contrasts. 

   coefs: A list of vectors of numeric coefficients corresponding to
          betas. 

   model: An lm object. 

  lambda: A matrix of coefficients in the appropriate order to be
          multiplied by the estimated coefficients of the lm object,
          possibly returned from 'par2lambda'. 

    cVec: A vector of constants for testing that the linear contrasts
          equal something other than zero.  If this is unspecified, it
          is assumed to be zero. 

       p: The significance level at which to perform the contrast test. 

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

     For 'par2lambda': A lambda matrix constructed for testing linear
     contrasts using lm output.

     For 'contrastTest': 

   test : Returns "REJECT" or "FAIL TO REJECT" based on the result of
          the test of hypothesis.

   Fstat: The F statistic for the test of contrast.

  pvalue: The corresponding pvalue for the F test.

    cEst: The contrast estimate.

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

     Denise Scholtens

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

     'lm'

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

     data(estrogen)
     ES <- pData(estrogen)[["ES"]]
     TIME <- pData(estrogen)[["TIME"]]   
     fit <- lm(exprs(estrogen)["40079_at",] ~ ES + TIME + ES*TIME)
     betaNames <- names(fit[["coef"]])
     betas <- list(c("ESP"),c("ESP","ESP:TIME48h"))
     coefs <- list(c(1),c(1,1))
     lambda <- par2lambda(betaNames,betas,coefs)
     contrastTest(fit,lambda)

