IndependenceTest            package:coin            R Documentation

_G_e_n_e_r_a_l _I_n_d_e_p_e_n_d_e_n_c_e _T_e_s_t_s

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

     The independence between two sets of variables of arbitrary
     measurement scales, possibly stratified in blocks, is tested
     conditional on the data.

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

     ## S3 method for class 'formula':
     independence_test(formula, data, subset = NULL, weights = NULL, ...)
     ## S3 method for class 'IndependenceProblem':
     independence_test(object, 
         teststat = c("maxtype", "quadtype", "scalar"),
         distribution = c("asympt", "approx", "exact"),
         alternative = c("two.sided", "less", "greater"),
         xtrafo = trafo, ytrafo = trafo, scores = NULL, 
         check = NULL, ...)
     ## S3 method for class 'table':
     independence_test(object, distribution = c("asympt", "approx"), ...)

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

 formula: a formula of the form  'y1 + ... + yp ~ x1 + ... + xq |
          block' where the variables on the left and right hand side
          may be measured on arbitrary scales (including censored ones
          on the left hand side) and 'block' is an  optional factor for
          stratification.

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

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

 weights: an optional formula of the form '~ w' defining integer valued
          weights for the observations.

  object: an object inheriting from class 'IndependenceProblem' or an
          object of class 'table'.

teststat: a character, the type of test statistic to be applied: either
          a standardized scalar test statistic ('scalar'), or a 
          maximum type statistic ('maxtype') or a quadratic form
          ('quadform').

alternative: a character, the alternative hypothesis must be one of
          '"two.sided"' (default), '"greater"' or     '"less"'.  You
          can specify just the initial letter.

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

  xtrafo: a function of transformations (see 'trafo') to be applied to
          the variables on the right hand side of 'formula', see below.

  ytrafo: a function of transformations (see 'trafo') to be applied to
          the variables on the left hand side of 'formula', see below.

  scores: a named list of scores to be attached to ordered factors. In
          case a variable is an unordered factor, it is coerced to
          'ordered' first.

   check: a function to be applied to objects of class 'IndendenceTest'
          in order to check for specific properties  of the data.

     ...: further arguments to be passed to or from methods such as the
          number of Monte-Carlo replications 'B' or arguments to
          'pmvnorm'.

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

     The null hypothesis of the independence between the variables on
     the  left hand side and the variables on the  right hand side of
     'formula', possibly stratified by 'block', is tested. The vector
     supplied via the 'weights' argument is  interpreted as observation
     counts.

     This function is the basic workhorse called by all other
     convenience functions, mainly by supplying transformations via the
     'xtrans' and 'ytrans' arguments.

     The 'scores' argument leads to linear-by-linear association tests
     against ordered alternatives. If the formula 'y ~ x' was supplied
     and both 'y' and 'x' are factors,  'scores = list(y = 1:k, x =
     c(1, 4, 6))' first triggers a coercion  to class 'ordered' of both
     variables and attaches the list elements as scores. The length of
     a score vector needs to be equal the number of  levels of the
     factor of interest.

     Additional arguments are passed to functions for the computation
     of the  null distribution. Such arguments may be the number of
     Monte-Carlo replications 'B' for the approximation of the null
     distribution or arguments to 'pmvnorm'.

     The basis of this function is the framework for conditional
     inference procedures by Strasser & Weber (1999).

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

     An object inheriting from class 'IndependenceTest-class' with
     methods 'show', 'statistic', 'expectation', 'covariance' and
     'pvalue'. The null distribution can be inspected by 'pperm',
     'dperm', 'qperm' and 'support' methods.

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

     Helmut Strasser & Christian Weber (1999), On the asymptotic theory
     of permutation statistics.  _Mathematical Methods of Statistics_,
     *8*, 220-250.

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

     data(asat, package = "coin")

     ### independence of asat and group via normal scores test
     independence_test(asat ~ group, data = asat,

         ### exact null distribution
         distribution = "exact", 

         ### one-sided test
         alternative = "greater",

         ### apply normal scores to asat$asat
         ytrafo = function(data) trafo(data, numeric_trafo = normal_trafo),

         ### indicator matrix of 1st level of group
         xtrafo = function(data) trafo(data, factor_trafo = function(x)
             matrix(x == levels(x)[1], ncol = 1))
     )

     ### same as
     normal_test(asat ~ group, data = asat, distribution = "exact", 
                 alternative = "greater")

