Performs Lehmacher's chi-squared test for marginal homogenity in a symmetric two-dimensional contingency table.

LehmacherTest(x, y = NULL)

# S3 method for mtest
print(x, digits = 4L, ...)

Arguments

x

either a two-dimensional contingency table in matrix form, or a factor object.

y

a factor object; ignored if x is a matrix.

digits

a non-null value for digits specifies the minimum number of significant digits to be printed in values. See details in print.default.

...

further arguments to be passed to or from other methods. They are ignored in this function.

Details

The null is that the probabilities of being classified into cells [i,j] and [j,i] are the same.

If x is a matrix, it is taken as a two-dimensional contingency table, and hence its entries should be nonnegative integers. Otherwise, both x and y must be vectors or factors of the same length. Incomplete cases are removed, vectors are coerced into factors, and the contingency table is computed from these.

Value

A list with class "mtest" containing the following components:

statistic

a vector with the value of the test statistics.

parameter

the degrees of freedom, which is always 1 in LehmacherTest.

p.value

a vector with the p-values of the single tests.

p.value.corr

a vector with the "hochberg" adjusted p-values of the single tests. (See p.adjust)

method

a character string indicating what type of test was performed.

data.name

a character string giving the name of the data.

References

Lehmacher, W. (1980) Simultaneous sign tests for marginal homogeneity of square contingency tables Biometrical Journal, Volume 22, Issue 8, pages 795-798

Author

Andri Signorell <andri@signorell.net>

See also

mcnemar.test (resp. BowkerTest for a CxC-matrix), StuartMaxwellTest, WoolfTest

Examples

x <- matrix(c(400,40,20,10, 
              50,300,60,20, 
              10,40,120,5, 
              5,90,50,80), nrow=4, byrow=TRUE)
              
LehmacherTest(x)
#> 
#> 	Lehmacher-Test on Marginal Homogeneity
#> 
#> data:  x
#>   X-squared      pval  pval adj    
#> 1    0.1852   0.66695   0.66695    
#> 2    5.3333   0.02092   0.04184   *
#> 3   30.4054 3.505e-08 1.052e-07 ***
#> 4   67.2222 2.220e-16 8.882e-16 ***
#> 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>