Type: Package
Title: Uniform Exact Functional Tests for Contingency Tables
Version: 1.0.1
Date: 2025-02-20
Author: Yiyi Li ORCID iD [aut, cre], Joe Song ORCID iD [aut]
Maintainer: Yiyi Li <gtarex@nmsu.edu>
Description: Testing whether two discrete variables have a functional relationship under null distributions where the two variables are statistically independent with fixed marginal counts. The fast enumeration algorithm was based on (Nguyen et al. 2020) <doi:10.24963/ijcai.2020/372>.
License: LGPL (≥ 3)
Encoding: UTF-8
Imports: Rcpp (≥ 1.0.5)
LinkingTo: Rcpp
Depends: R (≥ 3.5.0), stats
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0)
VignetteBuilder: knitr
Config/testthat/edition: 3
RoxygenNote: 7.3.2
NeedsCompilation: yes
Packaged: 2025-02-21 06:36:22 UTC; gtarex
Repository: CRAN
Date/Publication: 2025-02-21 07:00:02 UTC

Uniform Exact Functional Test on Two Discrete Random Variables

Description

Perform the uniform exact functional test on a contingency table to determine if the column variable is a function of the row variable.

Usage

UEFT(input, correct, log.p)

Arguments

input

A matrix of nonnegative integers representing a contingency table. Column is the casual and row is the effect.

correct

Logical; if implement the continuity correction. The description is at details. The default is TRUE.

log.p

Logical; if TRUE, the p-value is given as log(p). The default is FALSE. The default is FALSE.

Details

The uniform idea was implementated using uniform marginal distribution of a square table as null hypothesis.

Value

The exact p-value of the test.

Note

The functions provide a direct entry into the C++ implementations of the exact functional test.

Author(s)

Yiyi Li, Joe Song

Examples

 # Initial a table
 x = matrix(c(0,5,10,0,0,5), ncol=3)
 # With continuity correction
 UEFT(x)
 # Without continuity correction
 UEFT(x, FALSE)