View source: R/fast.chisq.test.R
| fast.chisq.test | R Documentation |
Performs a fast zero-tolerant Pearson's chi-squared test \insertCitepearson1900Upsilon to evaluate association between observations from two categorical variables.
fast.chisq.test(x, y, log.p = FALSE)
x |
a vector to
specify observations of the first
categorical variable. The vector can be of
numeric, character, or logical type.
|
y |
a vector to specify observations of
the second categorical variable.
Must not contain |
log.p |
a logical. If |
A list with class "htest"
containing the following components:
statistic |
the value of chi-squared test statistic. |
parameter |
the degrees of freedom. |
p.value |
the p-value of the test. |
estimate |
Cramér's V statistic representing the effect size. |
method |
a character string indicating the method used. |
data.name |
a character string giving the names of input data. |
The test uses an internal hash table, instead of matrix, to store the contingency table. Savings in both runtime and memory saving can be substantial if the contingency table is sparse and large. The test is implemented in C++, to give an additional layer of speedup over an R implementation.
pearson1900Upsilon
library("Upsilon")
weather <- c(
"rainy", "sunny", "rainy", "sunny", "rainy"
)
mood <- c(
"wistful", "upbeat", "upbeat", "upbeat", "wistful"
)
fast.chisq.test(weather, mood)
# The result is equivalent to:
modified.chisq.test(table(weather, mood))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.