medpolish               package:stats               R Documentation

_M_e_d_i_a_n _P_o_l_i_s_h _o_f _a _M_a_t_r_i_x

_D_e_s_c_r_i_p_t_i_o_n:

     Fits an additive model using Tukey's _median polish_ procedure.

_U_s_a_g_e:

     medpolish(x, eps = 0.01, maxiter = 10, trace.iter = TRUE,
               na.rm = FALSE)

_A_r_g_u_m_e_n_t_s:

       x: a numeric matrix.

     eps: real number greater than 0. A tolerance for convergence: see
          'Details'.

 maxiter: the maximum number of iterations

trace.iter: logical. Should progress in convergence be reported?

   na.rm: logical. Should missing values be removed?

_D_e_t_a_i_l_s:

     The model fitted is additive (constant + rows + columns). The
     algorithm works by alternately removing the row and column
     medians, and continues until the proportional reduction in the sum
     of absolute residuals is less than 'eps' or until there have been
     'maxiter' iterations. The sum of absolute residuals is printed at
     each iteration of the fitting process, if 'trace.iter' is 'TRUE'.
     If 'na.rm' is 'FALSE' the presence of any 'NA' value in 'x' will
     cause an error, otherwise 'NA' values are ignored.

     'medpolish' returns an object of class 'medpolish' (see below).
     There are printing and plotting methods for this class, which are
     invoked via by the generics 'print' and 'plot'.

_V_a_l_u_e:

     An object of class 'medpolish' with the following named
     components: 

 overall: the fitted constant term.

     row: the fitted row effects.

     col: the fitted column effects.

residuals: the residuals.

    name: the name of the dataset.

_R_e_f_e_r_e_n_c_e_s:

     Tukey, J. W. (1977). _Exploratory Data Analysis_, Reading
     Massachusetts: Addison-Wesley.

_S_e_e _A_l_s_o:

     'median'; 'aov' for a _mean_ instead of _median_ decomposition.

_E_x_a_m_p_l_e_s:

     require(graphics)

     ## Deaths from sport parachuting;  from ABC of EDA, p.224:
     deaths <-
         rbind(c(14,15,14),
               c( 7, 4, 7),
               c( 8, 2,10),
               c(15, 9,10),
               c( 0, 2, 0))
     dimnames(deaths) <- list(c("1-24", "25-74", "75-199", "200++", "NA"),
                              paste(1973:1975))
     deaths
     (med.d <- medpolish(deaths))
     plot(med.d)
     ## Check decomposition:
     all(deaths ==
         med.d$overall + outer(med.d$row,med.d$col, "+") + med.d$residuals)

