pairwise.chisq.test: Pairwise Chi-squared and Fisher Test

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/pairwise.R

Description

Calculate pairwise comparisons between group levels with corrections for multiple testing.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
pairwise.chisq.test(x, ...)
pairwise.fisher.test(x, ...)

## Default S3 method:
pairwise.chisq.test(x, g, p.adj = p.adjust.methods, ...)
## S3 method for class 'table'
pairwise.chisq.test(x, p.adj = p.adjust.methods,
                     DNAME = NULL, ...)

## Default S3 method:
pairwise.fisher.test(x, g, p.adj = p.adjust.methods, ...)
## S3 method for class 'table'
pairwise.fisher.test(x, p.adj = p.adjust.methods,
                     DNAME = NULL, ...)

Arguments

x

a numeric vector or matrix. x and g can also both be factors.

g

a vector; ignored if x is a matrix.

p.adj

correction method among holm, hochberg, hommel, bonferroni, BH, BY, fdr and none.

DNAME

table dimension names.

...

further arguments to be passed to or from methods.

Details

Calculate Chi-square or Fisher test p-values for all combinaisons of the levels of g.

Value

Object of class "pairwise.htest".

Author(s)

Antoine Filipovic Pierucci

References

Original functions written by Dr Jean-Philippe Jais.

See Also

pairwise.t.test, p.adjust.

Examples

1
2
3
4
5
x <- sample(1:2, 1e3, TRUE)
g <- sample(1:4, 1e3, TRUE)
pairwise.chisq.test(x, g)
tab <- table(g, x)
pairwise.fisher.test(tab, p.adj = "bonf")

Example output

	Pairwise comparisons using Pearson's Chi-squared tests 

data:  x and g 

  1 2 3 4
1 - - - -
2 1 - - -
3 1 1 - -
4 1 1 1 -

P value adjustment method: holm 

	Pairwise comparisons using Fisher's Exact Tests for Count Data 

data:  tab 

  1 2 3 4
1 - - - -
2 1 - - -
3 1 1 - -
4 1 1 1 -

P value adjustment method: bonferroni 

rmngb documentation built on May 29, 2017, 9:22 p.m.