paired_test_categorical {depigner} | R Documentation |
Statistical tests for paired categorical variable.
paired_test_categorical(tab)
tab |
a frequency table (an integer 'table', if a 'matrix' is provided, it will be coerced to a 'table' internally) |
If the test is requested for two paired groups, the
mcnemar.test
is used.
If the test is requested for more than two paired groups, the test
based on Cochran-Mantel-Haenzen for repeated measures is used
(powered by mantelhaen.test
)
A list with components 'P' (the computed P-value), 'stat' (the test statistic, either t or F), 'df' (degrees of freedom), 'testname' (test name), 'statname' (statistic name), 'namefun' ("paired_tstat", "rep_aov"), 'latexstat' (LaTeX representation of statname), 'plotmathstat' (for R - the plotmath representation of 'statname', as a character string), 'note' (contains a character string note about the test).
This function could be used as 'catTest' option in the
summary.formula
with method 'reverse'.
library(Hmisc)
data(Arthritis)
## two groups
summary(Treatment ~ Sex,
data = Arthritis,
method = "reverse",
test = TRUE,
catTest = paired_test_categorical
)
## more than two groups
summary(Improved ~ Sex,
data = Arthritis,
method = "reverse",
test = TRUE,
catTest = paired_test_categorical
)