create_ctree | R Documentation |
Make all conditional inference trees
create_ctree(
given_ind,
x_train,
mincriterion,
minsplit,
minbucket,
use_partykit = "on_error"
)
given_ind |
Numeric value. Indicates which features are conditioned on. |
x_train |
Numeric vector. Indicates the specific values of features for individual i. |
mincriterion |
Numeric value or vector equal to 1 - alpha where alpha is the nominal level of the conditional independence tests. Can also be a vector equal to the length of the number of features indicating which mincriterion to use when conditioning on various numbers of features. |
minsplit |
Numeric value. Equal to the value that the sum of the left and right daughter nodes need to exceed. |
minbucket |
Numeric value. Equal to the minimum sum of weights in a terminal node. |
use_partykit |
String. In some semi-rare cases |
List with conditional inference tree and the variables conditioned/not conditioned on.
Annabelle Redelmeier, Martin Jullum
if (requireNamespace("MASS", quietly = TRUE) & requireNamespace("party", quietly = TRUE)) {
m <- 10
n <- 40
n_samples <- 50
mu <- rep(1, m)
cov_mat <- cov(matrix(rnorm(n * m), n, m))
x_train <- data.table::data.table(MASS::mvrnorm(n, mu, cov_mat))
given_ind <- c(4, 7)
mincriterion <- 0.95
minsplit <- 20
minbucket <- 7
sample <- TRUE
create_ctree(
given_ind = given_ind, x_train = x_train,
mincriterion = mincriterion, minsplit = minsplit,
minbucket = minbucket, use_partykit = "on_error"
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.