paired_test_categorical {depigner}R Documentation

Paired test for categorical variables

Description

Statistical tests for paired categorical variable.

Usage

paired_test_categorical(tab)

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)

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

Note

This function could be used as 'catTest' option in the summary.formula with method 'reverse'.

Examples


  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
  )


[Package depigner version 0.8.4 Index]