Fisher's Exact Test for Count Data

Usage

fisher.test(x, y, alternative = "two.sided")

Arguments

x either a two-dimensional contingency table in matrix form, or a factor object.
y a factor object; ignored if x is a matrix.
alternative indicates the alternative hypothesis and must be one of "two.sided", "greater" or "less". You can specify just the initial letter. Only used in the 2 by 2 case.

Description

fisher.test performs Fisher's exact test for testing the null of independence of rows and columns in a contingency table with fixed marginals.

If x is a matrix, it is taken as a two-dimensional contingency table, and hence its entries should be nonnegative integers. Otherwise, both x and y must be vectors of the same length. Incomplete cases are removed, the vectors are coerced into factor objects, and the contingency table is computed from these.

Currently, only 2 by 2 tables can be tested.

Value

A list with class "htest" containing the following components:
p.value the p-value of the test.
alternative a character string describing the alternative hypothesis.
method the string "Fisher's Exact Test for Count Data".
data.name a character string giving the names of the data.


[Package Contents]