upsilon.test: Upsilon Test of Association for Count Data

View source: R/upsilon.test.R

upsilon.testR Documentation

Upsilon Test of Association for Count Data

Description

Performs the Upsilon test to evaluate association among categorical variables represented by a contingency table.

Usage

upsilon.test(x, log.p = FALSE)

Arguments

x

a matrix or data frame of floating or integer numbers to specify a contingency table. Entries must be non-negative.

log.p

a logical. If TRUE, the p-value is calculated in closed form to natural logarithm of p-value to improve numerical precision when p-value approaches zero. Defaults to FALSE.

Details

The Upsilon test is designed to promote dominant function patterns. In contrast to other tests of association to favor all function patterns, it is unique in demoting non-dominant function patterns.

Null hypothesis (H_0): Row and column variables are statistically independent.

Null population: A discrete uniform distribution, where each entry in the table has the same probability.

Null distribution: The Upsilon test statistic asymptotically follows a chi-squared distribution with (nrow(x) - 1)(ncol(x) - 1) degrees of freedom, under the null hypothesis on the null population.

See \insertCiteluo2021upsilonUpsilon for full details of the Upsilon test.

Value

A list with class "htest" containing:

statistic

the value of the Upsilon statistic.

parameter

the degrees of freedom.

p.value

the p-value.

estimate

the effect size.

method

a character string giving the test name.

data.name

a character string giving the name of input data.

observed

the observed counts, a matrix copy of the input data.

expected

the expected counts under the null hypothesis using the observed marginals.

References

\insertRef

luo2021upsilonUpsilon

Examples

library("Upsilon")

# A contingency table with independent row and column variables
x <- matrix(
  c(1, 1, 0, 
    1, 1, 0,
    1, 1, 0), 
  nrow = 3, byrow = TRUE
 )
 
print(x)

upsilon.test(x)

# A contingency table with a non-dominant function
x <- matrix(
  c(4, 0, 0, 
    0, 1, 0,
    0, 0, 1), 
  nrow = 3, byrow = TRUE
 )
 
print(x)

upsilon.test(x)

# A contingency table with a dominant function
x <- matrix(
  c(2, 0, 0, 
    0, 2, 0,
    0, 0, 2), 
  nrow = 3, byrow = TRUE)
  
print(x)

upsilon.test(x)

# Another contingency table with a dominant function
x <- matrix(
  c(3, 0, 0, 
    0, 3, 0,
    0, 0, 0), 
  nrow = 3, byrow = TRUE)

print(x)

upsilon.test(x)

Upsilon documentation built on March 7, 2026, 5:07 p.m.