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",
  reg_YhatonZ = "rf",
  reg_VonXZ = "rf",
  reg_RonZ = "rf",
  args_YonXZ = NULL,
  args_YonZ = NULL,
  args_YhatonZ = list(mtry = identity),
  args_VonXZ = list(mtry = identity),
  args_RonZ = list(mtry = identity),
  frac = 0.5,
  coin = FALSE,
  cointrol = NULL,
  ...
)

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. See ?regressions for more detail.

reg_YonZ

Character string or function specifying the regression for Y on Z, default is "rf" for random forest. See ?regressions for more detail.

reg_YhatonZ

Character string or function specifying the regression for the predicted values of reg_YonXZ on Z, default is "rf" for random forest. See ?regressions for more detail.

reg_VonXZ

Character string or function specifying the regression for estimating the conditional variance of Y given X and Z, default is "rf" for random forest. See ?regressions for more detail.

reg_RonZ

Character string or function specifying the regression for the estimated transformation of Y, X, and Z on Z, default is "rf" for random forest. See ?regressions for more detail.

args_YonXZ

Arguments passed to reg_YonXZ.

args_YonZ

Arguments passed to reg_YonZ.

args_YhatonZ

Arguments passed to reg_YhatonZ.

args_VonXZ

Arguments passed to reg_VonXZ.

args_RonZ

Arguments passed to reg_RonZ.

frac

Relative size of train split.

coin

Logical; whether or not to use the coin package for computing the test statistic and p-value. The coin package computes variances with n - 1 degrees of freedom. The default is FALSE.

cointrol

List; further arguments passed to independence_test.

...

Additional arguments currently ignored.

Details

The projected covariance measure test tests whether the conditional mean of Y given X and Z is independent of 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 <- X[, 2]^2 + Z[, 2] + rnorm(n)
(pcm1 <- pcm(Y, X, Z))


[Package comets version 0.0-2 Index]