Projected covariance measure test for conditional mean independence
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 = NULL,
args_VonXZ = NULL,
args_RonZ = NULL,
frac = 0.5,
indices = NULL,
coin = FALSE,
cointrol = NULL,
return_fitted_models = FALSE,
...
)
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.
models
List 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.
Number of repetitions with which to repeat the PCM test
Logical; whether to estimate the variance functional
Character string or function specifying the regression
for Y on X and Z, default is "rf"
for random forest.
See ?regressions
for more detail.
Character string or function specifying the regression
for Y on Z, default is "rf"
for random forest.
See ?regressions
for more detail.
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.
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.
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.
A list of named arguments passed to reg_YonXZ
.
A list of named arguments passed to reg_YonZ
.
A list of named arguments passed to reg_YhatonZ
.
A list of named arguments passed to reg_VonXZ
.
A list of named arguments passed to reg_RonZ
.
Relative size of train split.
A numeric vector of indices specifying the observations used
for estimating the estimating the direction (the other observations will
be used for computing the final test statistic). Default is NULL
and the indices will be generated randomly using frac
.
When using rep
larger than 1, a list (of length rep
) of
indices can be supplied.
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
).
Additional arguments currently ignored.
The projected covariance measure test tests whether the conditional mean of Y given X and Z is independent of X.
Lundborg, A. R., Kim, I., Shah, R. D., & Samworth, R. J. (2022). The Projected Covariance Measure for assumption-lean variable significance testing. arXiv preprint. tools:::Rd_expr_doi("10.48550/arXiv.2211.02039")
n <- 1e2
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))
Run the code above in your browser using DataLab