comet: Covariance measure tests with formula interface

View source: R/comet.R

cometR Documentation

Covariance measure tests with formula interface

Description

Covariance measure tests with formula interface

Usage

comet(formula, data, test = c("gcm", "pcm", "wgcm", "kgcm"), ...)

comets(formula, data, test = c("gcm", "pcm", "wgcm", "kgcm"), ...)

Arguments

formula

Formula of the form Y ~ X | Z for testing Y independent of X given Z. To specify a multivariate response, cbind(Y1, Y2) can be used on the left-hand side of the formula.

data

A data.frame containing the variables in formula.

test

Character string; "gcm", "pcm", "wgcm", or "kgcm".

...

Additional arguments passed to test, which includes the regression methods that are specific to test. For the GCM test, this includes reg_YonZ and reg_XonZ with their respective lists of arguments args_YonZ and args_XonZ.

Details

Formula-based interface for the generalised (GCM), projected (PCM), weighted (wGCM), kernel generalised (kGCM) and transformation model generalised (tram-GCM) covariance measure tests (COMETs). All of these COMETs are algorithm-agnostic and doubly robust tests of conditional independence, that is for the null hypothesis that X is independent of Y given Z. In the formula argument, this can be specified as Y ~ X | Z. The GCM test supports multivariate X, Y, and Z, while the PCM, wGCM, and kGCM require a one-dimensional Y.

Value

Object of class "gcm", "wgcm", "kgcm", or "pcm" and "htest". See gcm, wgcm, kgcm, pcm for details.

References

Kook, L. & Lundborg A. R. (2024). Algorithm-agnostic significance testing in supervised learning with multimodal data. Briefings in Bioinformatics, 25(6), 2024. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/bib/bbae475")}

Examples

tn <- 1e2
df <- data.frame(y = rnorm(tn), x1 = rnorm(tn), x2 = rnorm(tn), z = rnorm(tn))
comet(y ~ x1 + x2 | z, data = df, test = "gcm")


comets documentation built on Nov. 5, 2025, 5:09 p.m.

Related to comet in comets...