nominalTest: Compute Chi square or Fisher's exact test

Description Usage Arguments Value Examples

View source: R/nominalTest.r

Description

Depending on the value of the smallest expected count compute either a χ^2 or Fisher's exact test.

Usage

1
nominalTest(tab, limit.exp = 5)

Arguments

tab

Frequency table, received by applying table() to two nominal variables.

limit.exp

If the smallest expected count is at most limit.exp the p-value of a Fisher test is returned. Otherwise, a χ^2 test is computed.

Value

A list containing:

p

The computed p-value.

test

A string indicating the test that was used.

Examples

1
2
3
4
v1 <- as.factor(round(runif(40, 0, 3)))
v2 <- as.factor(round(runif(40, 2, 3)))
tab <- table(v1, v2)
nominalTest(tab)

reporttools documentation built on May 20, 2017, 5:44 a.m.

Search within the reporttools package
Search all R packages, documentation and source code