CMH {CMHNPA}R Documentation

CMH Test

Description

CMH returns the test statistics and p-values for the four CMH tests.

Usage

CMH(
  treatment,
  response,
  strata = NULL,
  a_ij = NULL,
  b_hj = NULL,
  test_OPA = TRUE,
  test_GA = TRUE,
  test_MS = TRUE,
  test_C = TRUE,
  cor_breakdown = TRUE
)

Arguments

treatment

a factor vector representing the treatment applied.

response

a factor vector giving the response category for the corresponding elements of treatment.

strata

a factor vector giving the strata or block for the corresponding elements of treatment and response.

a_ij

a t x b matrix of treatment scores. The matrix allows for different scores to be used over different strata. If a t x 1 vector of scores is provided, it is assumed that the scores are the same across strata and a warning provided.

b_hj

a c x b matrix of response scores. The matrix allows for different scores to be used over different strata. If a c x 1 vector of scores is provided, it is assumed that the scores are the same across strata and a warning provided.

test_OPA

TRUE or FALSE flag to include the calculation of the OPA test values.

test_GA

TRUE or FALSE flag to include the calculation of the GA test values.

test_MS

TRUE or FALSE flag to include the calculation of the MS test values. If response scores are not included, this test will not be performed.

test_C

TRUE or FALSE flag to include the calculation of the C test values. If response scores and treatment scores are not included, this test will not be performed.

cor_breakdown

TRUE or FALSE flag to indicate if a correlation breakdown over the strata is required.

Details

Provided the required information is used in the function, the function will return all four CMH test results.

Value

The CMH test results for the four tests assuming the required information is supplied.

References

Rayner, J.C.W and Livingston, G. C. (2022). An Introduction to Cochran-Mantel-Haenszel Testing and Nonparametric ANOVA. Wiley.

Examples

CMH(treatment = marriage$religion, response = marriage$opinion,
strata = marriage$education, test_OPA = FALSE, test_MS = FALSE)

[Package CMHNPA version 1.1.1 Index]