Learn R Programming

depigner (version 0.9.1)

paired_test_categorical: Paired test for categorical variables

Description

Statistical tests for paired categorical variable.

Usage

paired_test_categorical(tab)

Value

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).

Arguments

tab

a frequency table (an integer `table`, if a `matrix` is provided, it will be coerced to a `table` internally)

Details

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)

Examples

Run this code
# \donttest{
  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
  )
# }

Run the code above in your browser using DataLab