fisher.pval {corpora}R Documentation

P-values of Fisher's exact test for frequency comparisons (corpora)

Description

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.

Usage


fisher.pval(k1, n1, k2, n2, 
           alternative = c("two.sided", "less", "greater"))

Arguments

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

Details

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.

Value

The p-value of Fisher's exact test applied to the given data (or a vector of p-values).

Author(s)

Stefan Evert

References

Fisher, R. A. (1934). Statistical Methods for Research Workers. Oliver & Boyd, Edinburgh, 2nd edition (1st edition 1925, 14th edition 1970).

See Also

fisher.test, chisq.pval, rel.risk.cint


[Package corpora version 0.3-2.1 Index]