rcompanion (version 2.2.2)

nominalSymmetryTest: Exact and Monte Carlo symmetry tests for paired contingency tables

Description

Conducts an omnibus symmetry test for a paired contingency table and then post-hoc pairwise tests. This is similar to McNemar and McNemar-Bowker tests in use.

Usage

nominalSymmetryTest(x, method = "fdr", digits = 3, ...)

Arguments

x

A two-way contingency table. It must be square. It can have two or more levels for each dimension.

method

The method to adjust multiple p-values. See stats::p.adjust.

digits

The number of significant digits in the output.

...

Additional arguments, passed to EMT::multinomial.test.

Value

A list containing: a data frame of results of the global test; a data frame of results of the pairwise results; and a data frame mentioning the p-value adjustment method.

Details

If Monte Carlo is not used, the test of symmetry uses an exact test by conducting either a binomial or multinomial goodness-of-fit test.

These are equivalent to uncorrected McNemar and McNemar-Bowker tests, but will not fail when there are zeros in critical cells, as will the mcnemar.test function.

References

http://rcompanion.org/handbook/H_05.html

See Also

pairwiseMcnemar, groupwiseCMH, pairwiseNominalIndependence, pairwiseNominalMatrix

Examples

Run this code
# NOT RUN {
### 2 x 2 repeated matrix example
data(AndersonRainBarrel)
nominalSymmetryTest(AndersonRainBarrel)
                    
### 3 x 3 repeated matrix example with Monte Carlo
data(AndersonRainGarden)
nominalSymmetryTest(AndersonRainGarden,
                    MonteCarlo = TRUE,
                    ntrial     = 10000)
                    
### 4 x 4 repeated matrix example that fails with mcnemar.test
data(Religion)
nominalSymmetryTest(Religion,
                    MonteCarlo = TRUE,
                    ntrial     = 10000)
                                                              
# }

Run the code above in your browser using DataLab