View source: R/contingency.tables.R
add.cross.strata.test | R Documentation |
Applies and adds a hypothesis test to a contingency.tables
object.
add.cross.strata.test(tables,name,htests,types=c("asymptotic","monte.carlo","exact"))
tables |
An object of class |
name |
The name of the hypothesis test |
htests |
A function or list of functions which take a three dimensional array as it's argument
and returns an object of class |
types |
A character vector with the same number of items as htests, indicating what type of test was done |
A contingency.tables
object identical to tables
, but with the test applied to each table.
add.mantel.haenszel
add.test
dat<-data.frame(a=rnorm(100)>.5,b=rnorm(100)>0,c=rnorm(100)>(-.5))
tables<-contingency.tables(
row.vars=a,
col.vars=b,
stratum.var=c,data=dat)
add.cross.strata.test(tables,"Mantel-Haenszel",list(function(x) mantelhaen.test(x,correct=FALSE)),
"asymptotic")
tables
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.