Weighted Generalised covariance measure test
wgcm(
Y,
X,
Z,
reg_YonZ = "rf",
reg_XonZ = "rf",
reg_wfun = "rf",
args_YonZ = NULL,
args_XonZ = NULL,
args_wfun = NULL,
frac = 0.5,
B = 499L,
coin = TRUE,
cointrol = NULL,
return_fitted_models = FALSE,
multivariate = c("none", "YonZ", "XonZ", "both"),
...
)Object of class 'wgcm' and 'htest' with the following
components:
statisticThe value of the test statistic.
p.valueThe p-value for the hypothesis
parameterIn case X is multidimensional, this is the degrees of freedom used for the chi-squared test.
hypothesisString specifying the null hypothesis .
null.valueString specifying the null hypothesis.
methodThe string "Generalised covariance measure test".
data.nameA character string giving the name(s) of the data.
rYResiduals for the Y on Z regression.
rXWeighted residuals for the X on Z regression.
WEstimated weights.
modelsList of fitted regressions if return_fitted_models is TRUE.
Vector of response values. Can be supplied as a numeric vector or a single column matrix.
Matrix or data.frame of covariates.
Matrix or data.frame of covariates.
Character string or function specifying the regression for
Y on Z. See ?regressions for more detail.
Character string or function specifying the regression for
X on Z. See ?regressions for more detail.
Character string or function specifying the regression for
estimating the weighting function.
See ?regressions for more detail.
A list of named arguments passed to reg_YonZ.
A list of named arguments passed to reg_XonZ.
Additional arguments passed to reg_XonZ.
Relative size of train split.
Number of bootstrap samples. Only applies if type = "max" is
used.
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 TRUE.
List; further arguments passed to
independence_test.
Logical; whether to return the fitted regressions
(default is FALSE).
Character; specifying which regression can handle
multivariate outcomes ("none", "YonZ", "XonZ", or
"both"). If "none", then the regression is run using each
column in Y (or X) as the response.
Additional arguments currently ignored.
The weighted generalised covariance measure test tests whether a weighted version of the conditional covariance of Y and X given Z is zero.
Scheidegger, C., Hörrmann, J., & Bühlmann, P. (2022). The weighted generalised covariance measure. Journal of Machine Learning Research, 23(273), 1-68.
n <- 100
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)
(wgcm1 <- wgcm(Y, X, Z))
Run the code above in your browser using DataLab