wgcm.est {weightedGCM} | R Documentation |
Weighted Generalised Covariance Measure (WGCM) With Estimated Weight Function Conditional Independence Test
Description
The Weighted Generalised Covariance Measure (WGCM) with Estimated Weight Function is a test for conditional independence. It is a generalisation of the Generalised Covariance Measure implemented in the R package GeneralisedCovarianceMeasure.
Usage
wgcm.est(X, Y, Z, beta = 0.3, regr.meth, regr.pars = list(), nsim = 499)
Arguments
X |
A (n x d_X) numeric matrix with n observations of d_X variables. |
Y |
A (n x d_Y) numeric matrix with n observations of d_Y variables. |
Z |
A (n x d_Z) numeric matrix with n observations of d_Z variables. |
beta |
A real number between 0 and 1 indicating the fraction of the sample used to estimate the weight function. |
regr.meth |
One of "gam" and "xgboost" indicating the regression method used to estimate the conditional expectations E[X|Z] and E[Y|Z] and the weight function sign(E[(X-E[X|Z])(Y-E[Y|Z])|Z]). |
regr.pars |
Optional additional regression parameters according to GeneralisedCovarianceMeasure::comp.resids() |
nsim |
Number of samples used to calculate the p-value using simulation. Only used if max(d_X, d_Y) > 1. |
Value
A p-value for the null hypothesis of conditional independence of X and Y given Z.
References
Please cite the following papers. Cyrill Scheidegger, Julia Hoerrmann, Peter Buehlmann: "The Weighted Generalised Covariance Measure" https://arxiv.org/abs/2111.04361
Rajen D. Shah, Jonas Peters: "The Hardness of Conditional Independence Testing and the Generalised Covariance Measure" https://arxiv.org/abs/1804.07203
Examples
set.seed(1)
n <- 200
Z <- rnorm(n)
X <- Z + 0.3*rnorm(n)
Y1 <- Z + 0.3*rnorm(n)
Y2 <- Z + 0.3*rnorm(n) + 0.3*X
Y3 <- Z + 0.3*rnorm(n) + 0.15*X^2
wgcm.est(X, Y1, Z, beta = 0.3, regr.meth = "gam")
wgcm.est(X, Y2, Z, beta = 0.3, regr.meth = "gam")
wgcm.est(X, Y3, Z, beta = 0.3, regr.meth = "gam")