anova.mlm               package:stats               R Documentation

_C_o_m_p_a_r_i_s_o_n_s _b_e_t_w_e_e_n _M_u_l_t_i_v_a_r_i_a_t_e _L_i_n_e_a_r _M_o_d_e_l_s

_D_e_s_c_r_i_p_t_i_o_n:

     Compute a (generalized) analysis of variance table for one or more
      multivariate linear models.

_U_s_a_g_e:

     ## S3 method for class 'mlm':
     anova(object, ...,
           test =
              c("Pillai", "Wilks", "Hotelling-Lawley", "Roy", "Spherical"),
           Sigma = diag(nrow = p), T = Thin.row(proj(M) - proj(X)),
            M = diag(nrow = p), X = ~0,
           idata = data.frame(index = seq_len(p)))

_A_r_g_u_m_e_n_t_s:

  object: an object of class '"mlm"'.

     ...: further objects of class '"mlm"'.

    test: choice of test statistic (see below).

   Sigma: (only relevant if  'test == "Spherical"').  Covariance matrix
          assumed proportional to 'Sigma'.

       T: transformation matrix.  By default computed from 'M' and 'X'.

       M: formula or matrix describing the outer projection (see
          below).

       X: formula or matrix describing the inner projection (see
          below).

   idata: data frame describing intra-block design.

_D_e_t_a_i_l_s:

     The 'anova.mlm' method uses either a multivariate test statistic
     for the summary table, or a test based on sphericity assumptions
     (i.e. that the covariance is proportional to a given matrix).

     For the multivariate test, Wilks' statistic is most popular in the
     literature, but the default Pillai-Bartlett statistic is
     recommended by Hand and Taylor (1987).  See 'summary.manova' for
     further details.

     For the '"Spherical"' test, proportionality is usually with the
     identity matrix but a different matrix can be specified using
     'Sigma'). Corrections for asphericity known as the
     Greenhouse-Geisser, respectively Huynh-Feldt, epsilons are given
     and adjusted F tests are performed.

     It is common to transform the observations prior to testing. This
     typically involves  transformation to intra-block differences, but
     more complicated within-block designs can be encountered, making
     more elaborate transformations necessary.  A transformation matrix
     'T' can be given directly or specified as the difference between
     two projections onto the spaces spanned by 'M' and 'X', which in
     turn can be given as matrices or as model formulas with respect to
     'idata' (the tests will be invariant to parametrization of the
     quotient space 'M/X').

     As with 'anova.lm', all test statistics use the SSD matrix from
     the largest model considered as the (generalized) denominator.

     Contrary to other 'anova' methods, the intercept is not excluded
     from the display in the single-model case.  When contrast
     transformations are involved, it often makes good sense to test
     for a zero intercept.

_V_a_l_u_e:

     An object of class '"anova"' inheriting from class '"data.frame"'

_N_o_t_e:

     The Huynh-Feldt epsilon differs from that calculated by SAS (as of
     v. 8.2) except when the DF is equal to the number of observations
     minus one.  This is believed to be a bug in SAS, not in R.

_R_e_f_e_r_e_n_c_e_s:

     Hand, D. J. and Taylor, C. C.  (1987) _Multivariate Analysis of
     Variance and Repeated Measures._ Chapman and Hall.

_S_e_e _A_l_s_o:

     'summary.manova'

_E_x_a_m_p_l_e_s:

     require(graphics)
     utils::example(SSD) # Brings in the mlmfit and reacttime objects

     mlmfit0 <- update(mlmfit, ~0)

     ### Traditional tests of intrasubj. contrasts
     ## Using MANOVA techniques on contrasts:
     anova(mlmfit, mlmfit0, X=~1)

     ## Assuming sphericity
     anova(mlmfit, mlmfit0, X=~1, test="Spherical") 

     ### tests using intra-subject 3x2 design
     idata <- data.frame(deg=gl(3,1,6,labels=c(0,4,8)),
                         noise=gl(2,3,6,labels=c("A","P")))

     anova(mlmfit, mlmfit0, X = ~ deg + noise,
           idata = idata, test = "Spherical")
     anova(mlmfit, mlmfit0, M = ~ deg + noise, X = ~ noise,
           idata = idata, test="Spherical" )
     anova(mlmfit, mlmfit0, M = ~ deg + noise, X = ~ deg,
           idata = idata, test="Spherical" )

     f <- factor(rep(1:2,5)) # bogus, just for illustration
     mlmfit2 <- update(mlmfit, ~f)
     anova(mlmfit2, mlmfit, mlmfit0, X = ~1, test = "Spherical")
     anova(mlmfit2, X = ~1, test = "Spherical")
     # one-model form, eqiv. to previous 

     ### There seems to be a strong interaction in these data
     plot(colMeans(reacttime))

