pcm {comets}R Documentation

Projected covariance measure test for conditional mean independence

Description

Projected covariance measure test for conditional mean independence

Usage

pcm(
  Y,
  X,
  Z,
  rep = 1,
  est_vhat = TRUE,
  reg_YonXZ = "rf",
  reg_YonZ = "rf",
  args_YonXZ = NULL,
  args_YonZ = NULL,
  mtry = identity,
  ...
)

Arguments

Y

Vector of response values. Can be supplied as a numeric vector or a single column matrix.

X

Matrix or data.frame of covariates.

Z

Matrix or data.frame of covariates.

rep

Number of repetitions with which to repeat the PCM test

est_vhat

Logical; whether to estimate the variance functional

reg_YonXZ

Character string or function specifying the regression for Y on X and Z, default is "rf" for random forest.

reg_YonZ

Character string or function specifying the regression for Y on Z, default is "rf" for random forest.

args_YonXZ

Arguments passed to reg

args_YonZ

Arguments passed to reg

mtry

Argument passed to ranger

...

Additional arguments passed to ranger

Details

The projected covariance measure test tests whether the conditional mean of Y given X and Z depends on X.

Value

Object of class 'pcm' and 'htest' with the following components:

statistic

The value of the test statistic.

p.value

The p-value for the hypothesis

parameter

In case X is multidimensional, this is the degrees of freedom used for the chi-squared test.

hypothesis

Null hypothesis of conditional mean independence.

null.value

Null hypothesis of conditional mean independence.

method

The string "Projected covariance measure test".

data.name

A character string giving the name(s) of the data.

check.data

A data.frame containing the residuals for plotting.

References

Lundborg, A. R., Kim, I., Shah, R. D., & Samworth, R. J. (2022). The Projected Covariance Measure for assumption-lean variable significance testing. arXiv preprint. doi: 10.48550/arXiv.2211.02039

Examples

n <- 150
X <- matrix(rnorm(2 * n), ncol = 2)
colnames(X) <- c("X1", "X2")
Z <- matrix(rnorm(2 * n), ncol = 2)
colnames(Z) <- c("Z1", "Z2")
Y <- rnorm(n) # X[, 2] + Z[, 2] + rnorm(1e3)
(pcm1 <- pcm(Y, X, Z))


[Package comets version 0.0-1 Index]