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

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/marginal-change-test.R

Description

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

Usage

1

Arguments

tables

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

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 \insertCitesharma2020COPTYPDiffXTables.

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.

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.

Author(s)

Ruby Sharma and Joe Song

References

\insertAllCited

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
  # 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)

DiffXTables documentation built on May 16, 2021, 9:07 a.m.