add.mantel.haenszel {Deducer}R Documentation

Apply the Mantel-Haenszel test to a Contingency Table

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

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

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)

[Package Deducer version 0.7-9 Index]