indepTests | R Documentation |
The Pearson's Chi-Squared test, likelihood ratio (G test) of independence, Fisher's Exact test, and linear-by-linear association test are performed on the data matrix.
indepTests(x, digits = 3)
x |
an object of class |
digits |
number of digits to round to |
A Pearson's Chi-Squared test Yate's Continuity Correction is applied in the case of 2 by 2 tables.
A table with method name, test statistic, degrees of freedom, and p-value reported for each Chi-squared test.
Derek Chiu
descr::CrossTable()
# Example from documentation of CrossTable
library(descr)
data(esoph, package = "datasets")
ct <- CrossTable(esoph$alcgp, esoph$agegp, expected = TRUE,
chisq = FALSE, prop.chisq = FALSE,
dnn = c("Alcohol consumption", "Tobacco consumption"))
indepTests(ct)
# Better example
set.seed(1108)
A <- rbinom(100, 3, 0.2)
B <- rbinom(100, 4, 0.8)
ct <- CrossTable(A, B)
indepTests(ct)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.