InvariantConditionalQuantilePrediction {CondIndTests} | R Documentation |
Invariant conditional quantile prediction.
Description
Tests the null hypothesis that Y and E are independent given X.
Usage
InvariantConditionalQuantilePrediction(Y, E, X, alpha = 0.05,
verbose = FALSE, test = fishersTestExceedance,
mtry = sqrt(NCOL(X)), ntree = 100, nodesize = 5, maxnodes = NULL,
quantiles = c(0.1, 0.5, 0.9), returnModel = FALSE)
Arguments
Y |
An n-dimensional vector. |
E |
An n-dimensional vector. If |
X |
A matrix or dataframe with n rows and p columns. |
alpha |
Significance level. Defaults to 0.05. |
verbose |
If |
test |
Unconditional independence test that tests whether exceedence is
independent of E. Defaults to |
mtry |
Random forest parameter: Number of variables randomly sampled as
candidates at each split. Defaults to |
ntree |
Random forest parameter: Number of trees to grow. Defaults to 100. |
nodesize |
Random forest parameter: Minimum size of terminal nodes. Defaults to 5. |
maxnodes |
Random forest parameter: Maximum number of terminal nodes trees in the forest can have. Defaults to NULL. |
quantiles |
Quantiles for which to test independence between exceedence and E.
Defaults to |
returnModel |
If |
Value
A list with the following entries:
-
pvalue
The p-value for the null hypothesis that Y and E are independent given X. -
model
The fitted quantile regression forest model ifreturnModel = TRUE
.
Examples
# Example 1
n <- 1000
E <- rbinom(n, size = 1, prob = 0.2)
X <- 4 + 2 * E + rnorm(n)
Y <- 3 * (X)^2 + rnorm(n)
InvariantConditionalQuantilePrediction(Y, as.factor(E), X)
# Example 2
E <- rbinom(n, size = 1, prob = 0.2)
X <- 4 + 2 * E + rnorm(n)
Y <- 3 * E + rnorm(n)
InvariantConditionalQuantilePrediction(Y, as.factor(E), X)