add.mantel.haenszel: Apply the Mantel-Haenszel test to a Contingency Table

Description Usage Arguments Details Value See Also Examples

View source: R/contingency.tables.R

Description

Applies and adds the Cochran-Mantel-Haenzsel test to a contingency.tables object. The Cochran-Mantel-Haenzsel tests the independence of two nominal variables, stratified by a third nominal variable, assuming no three way interaction.

Usage

1
add.mantel.haenszel(tables,conservative=FALSE)

Arguments

tables

An object of class contingency.tables

conservative

Should a continuity 'correction' be applied

Details

This is a convenience function wrapping mantelhaen.test in a add.cross.strata.test call. See mantelhaen.test for further details.

Value

A contingency.tables object identical to tables, but with the test applied to each table.

See Also

add.cross.strata.test add.test mantelhaen.test

Examples

1
2
3
4
5
6
7
dat<-data.frame(a=rnorm(100)>.5,b=rnorm(100)>0,c=rnorm(100)>(-.5))
tables1<-contingency.tables(
 row.vars=a,
 col.vars=b,
 stratum.var=c,data=dat)
tables1<-add.mantel.haenszel(tables1)
print(tables1,prop.r=TRUE,prop.c=TRUE,prop.t=FALSE)

Deducer documentation built on May 2, 2019, 8:35 a.m.