fisher.pval {corpora} | R Documentation |
This function computes the p-value of Fisher's exact test (Fisher 1934) for the comparison of corpus frequency counts (under the null hypothesis of equal population proportions). In the two-sided case, a fast approximation is used that may be inaccurate for small samples.
fisher.pval(k1, n1, k2, n2, alternative = c("two.sided", "less", "greater"))
k1 |
frequency of a type in the first corpus (or an integer vector of type frequencies) |
n1 |
the sample size of the first corpus (or an integer vector specifying the sizes of different samples) |
k2 |
frequency of the type in the second corpus (or an integer
vector of type frequencies, in parallel to k1 ) |
n2 |
the sample size of the second corpus (or an integer vector
specifying the sizes of different samples, in parallel to
n1 ) |
alternative |
a character string specifying the alternative
hypothesis; must be one of two.sided (default), less
or greater |
When alternative
is two.sided
, a fast approximation of
the two-sided p-value is used (multiplying the appropriate
single-sided tail probability by two), which may be inaccurate for
small samples. Unlike the exact algorithm of
fisher.test
, this implementation is memory-efficient and
can be applied to large samples and/or large frequency counts.
For one-sided tests, the p-values returned by this functions are
identical to those computed by fisher.test
on two-by-two
contingency tables.
The p-value of Fisher's exact test applied to the given data (or a vector of p-values).
Stefan Evert
Fisher, R. A. (1934). Statistical Methods for Research Workers. Oliver & Boyd, Edinburgh, 2nd edition (1st edition 1925, 14th edition 1970).
fisher.test
, chisq.pval
,
rel.risk.cint