model.tables              package:stats              R Documentation

_C_o_m_p_u_t_e _T_a_b_l_e_s _o_f _R_e_s_u_l_t_s _f_r_o_m _a_n _A_o_v _M_o_d_e_l _F_i_t

_D_e_s_c_r_i_p_t_i_o_n:

     Computes summary tables for model fits, especially complex 'aov'
     fits.

_U_s_a_g_e:

     model.tables(x, ...)

     ## S3 method for class 'aov':
     model.tables(x, type = "effects", se = FALSE, cterms, ...)

     ## S3 method for class 'aovlist':
     model.tables(x, type = "effects", se = FALSE, ...)

_A_r_g_u_m_e_n_t_s:

       x: a model object, usually produced by 'aov'

    type: type of table: currently only '"effects"' and '"means"' are
          implemented.

      se: should standard errors be computed?

  cterms: A character vector giving the names of the terms for which
          tables should be computed. The default is all tables.

     ...: further arguments passed to or from other methods.

_D_e_t_a_i_l_s:

     For 'type = "effects"' give tables of the coefficients for each
     term, optionally with standard errors.

     For 'type = "means"' give tables of the mean response for each
     combinations of levels of the factors in a term.

_V_a_l_u_e:

     An object of class '"tables.aov"', as list which may contain
     components 

  tables: A list of tables for each requested term.

       n: The replication information for each term.

      se: Standard error information.

_W_a_r_n_i_n_g:

     The implementation is incomplete, and only the simpler cases have
     been tested thoroughly.

     Weighted 'aov' fits are not supported.

_S_e_e _A_l_s_o:

     'aov', 'proj', 'replications', 'TukeyHSD', 'se.contrast'

_E_x_a_m_p_l_e_s:

     ## From Venables and Ripley (2002) p.165.
     N <- c(0,1,0,1,1,1,0,0,0,1,1,0,1,1,0,0,1,0,1,0,1,1,0,0)
     P <- c(1,1,0,0,0,1,0,1,1,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0)
     K <- c(1,0,0,1,0,1,1,0,0,1,0,1,0,1,1,0,0,0,1,1,1,0,1,0)
     yield <- c(49.5,62.8,46.8,57.0,59.8,58.5,55.5,56.0,62.8,55.8,69.5,
     55.0, 62.0,48.8,45.5,44.2,52.0,51.5,49.8,48.8,57.2,59.0,53.2,56.0)

     npk <- data.frame(block=gl(6,4), N=factor(N), P=factor(P),
                       K=factor(K), yield=yield)
     npk.aov <- aov(yield ~ block + N*P*K, npk)
     model.tables(npk.aov, "means", se=TRUE)

     ## as a test, not particularly sensible statistically
     options(contrasts=c("contr.helmert", "contr.treatment"))
     npk.aovE <- aov(yield ~  N*P*K + Error(block), npk)
     model.tables(npk.aovE,  se=TRUE)
     model.tables(npk.aovE, "means")

