MarginalHomogeneityTest         package:coin         R Documentation

_M_a_r_g_i_n_a_l _H_o_m_o_g_e_n_e_i_t_y _T_e_s_t

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

     Testing marginal homogeneity in a complete block design.

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

     ## S3 method for class 'formula':
     mh_test(formula, data, subset = NULL, ...)
     ## S3 method for class 'table':
     mh_test(object, ...)
     ## S3 method for class 'SymmetryProblem':
     mh_test(object, distribution = c("asympt", "approx"), ...) 

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

 formula: a formula of the form 'y ~ x | block' where 'y' is a factor
          giving the data values and  'x' a factor with two or more
          levels giving the corresponding replications. 'block' is an
          optional factor (which is generated automatically when
          omitted).

    data: an optional data frame containing the variables in the model
          formula.

  subset: an optional vector specifying a subset of observations to be
          used.

  object: an object inheriting from class 'SymmetryProblem' or a 
          'table' with identical 'dimnames' attributes.

distribution: a character, the null distribution of the test statistic
          can be approximated by its asymptotic distribution ('asympt')
           or via Monte-Carlo resampling ('approx').

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

_D_e_t_a_i_l_s:

     The null hypothesis of independence of row and column totals is
     tested. The corresponding test for binary factors 'x' and 'y' is
     known as McNemar test.

     Scores must be a list of length one (row and column scores
     coincide). When scores are given or if 'x' is ordered, the
     corresponding  linear association test is computed (see Agresti,
     2002).

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

     An object inheriting from class 'IndependenceTest' with methods
     'show', 'pvalue' and 'statistic'.

_R_e_f_e_r_e_n_c_e_s:

     Alan Agresti (2002), _Categorical Data Analysis_. Hoboken, New  
     Jersey: John Wiley & Sons.

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

     ### Opinions on Pre- and Extramarital Sex, Agresti (2002), page 421
     opinions <- c("always wrong", "almost always wrong", 
                   "wrong only sometimes", "not wrong at all")

     PreExSex <- as.table(matrix(c(144, 33, 84, 126, 
                                     2,  4, 14,  29, 
                                     0,  2,  6,  25, 
                                     0,  0,  1,  5), nrow = 4, 
                                 dimnames = list(PremaritalSex = opinions,
                                                 ExtramaritalSex = opinions)))

     ### treating response as nominal
     mh_test(PreExSex)

     ### and as ordinal
     mh_test(PreExSex, scores = list(response = 1:length(opinions)))

