Learn R Programming

rcompanion (version 1.0.1)

pairwiseMcnemar: Pairwise McNemar and related tests for Cochran Q test post-hoc

Description

Conducts pairwise McNemar, exact, and permutation tests as a post-hoc to Cochran Q test.

Usage

pairwiseMcnemar(x, g, block, test = "exact", method = "fdr", digits = 3, correct = FALSE)

Arguments

x
The response variable.
g
The grouping variable.
block
The blocking variable.
test
If "exact", conducts an exact test of symmetry analogous to a McNemar test. If "mcnemar", conducts a McNemar test of symmetry. If "permutation", conducts a permutation test analogous to a McNemar test.
method
The method for adjusting multiple p-values. See p.adjust.
digits
The number of significant digits in the output.
correct
If TRUE, applies a continuity correction for the McNemar 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

The component tables for the pairwise tests must be of size 2 x 2.

References

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

See Also

nominalSymmetryTest, groupwiseCMH, pairwiseNominalIndependence, pairwiseNominalMatrix

Examples

Run this code
### Cochran Q post-hoc example
data(HayleySmith)
library(RVAideMemoire)
cochran.qtest(Response ~ Practice | Student,
              data = HayleySmith)
pairwiseMcnemar(x       = HayleySmith$Response,
                g       = HayleySmith$Practice,
                block   = HayleySmith$Student,
                test    = "exact",
                method  = "fdr",
                digits  = 3)

Run the code above in your browser using DataLab