Learn R Programming

DiffXTables (version 0.1.1)

marginal.change.test: Test for Marginal Change Across Contingency Tables

Description

The test detects change in either row or column marginal distributions across given contingency tables.

Usage

marginal.change.test(tables)

Arguments

tables

a list of at least two non-negative matrices or data frames representing contingency tables of the same dimensions.

Value

A list with class "htest" containing the following components:

statistic

the chi-squared test statistic.

parameter

the degrees of freedom of the null chi-squared distribution.

p.value

the p-value for the test, computed using the chi-squared distribution.

Details

The marginal change test determines whether the patterns underlying multiple input contingency tables have changed row or column marginal distributions. Its test statistic is proved to asymptotically follow the chi-squared distribution under the null hypothesis of same row and marginal distributions across tables sharma2020COPTYPDiffXTables.

The test statistic is minimized to zero if and only if observed row marginal distributions are the same across tables and so do the column marginal distributions.

References

See Also

sharma.song.test, strength.test, and type.analysis.

Examples

Run this code
# NOT RUN {
  # Two first-order differential tables:
  tables <- list(
   matrix(c(30,0,0,
            0,10,0,
            0,0,20), nrow=3),
   matrix(c(10,0,0,
            0,20,0,
            0,0,30), nrow=3)
  )
  marginal.change.test(tables)
  
  # Tables differ in the second-order but not first-order:
  tables <- list(
    matrix(c(4,0,0,
             0,4,0,
             0,0,4), nrow=3),
    matrix(c(0,0,4,
             0,4,0,
             4,0,0), nrow=3)
  )
   marginal.change.test(tables)
# }

Run the code above in your browser using DataLab