This function computes the p-value of Pearsons's chi-squared test for
the comparison of corpus frequency counts (under the null hypothesis
of equal population proportions). It is based on the chi-squared
statistic \(X^2\) implemented by the chisq
function.
chisq.pval(k1, n1, k2, n2, correct = TRUE,
alternative = c("two.sided", "less", "greater"))
The p-value of Pearson's chi-squared test applied to the given data (or a vector of p-values).
frequency of a type in the first corpus (or an integer vector of type frequencies)
the sample size of the first corpus (or an integer vector specifying the sizes of different samples)
frequency of the type in the second corpus (or an integer
vector of type frequencies, in parallel to k1
)
the sample size of the second corpus (or an integer vector
specifying the sizes of different samples, in parallel to
n1
)
if TRUE
, apply Yates' continuity correction
(default)
a character string specifying the alternative
hypothesis; must be one of two.sided
(default), less
or greater
Stephanie Evert (https://purl.org/stephanie.evert)
The p-values returned by this functions are identical to those
computed by chisq.test
(two-sided only) and
prop.test
(one-sided and two-sided) for two-by-two
contingency tables.
chisq
, fisher.pval
,
chisq.test
, prop.test
chisq.test(cont.table(99, 1000, 36, 1000))
chisq.pval(99, 1000, 36, 1000)
Run the code above in your browser using DataLab