| discover_confirm | R Documentation |
A single call that splits the data, imputes each half separately, fits
the Stack/M tree on the discovery half, and tests the resulting
partition on the confirmation half. Equivalent to calling
split_holdout(), mice::mice() twice, ctree_stacked() and
confirm_ctreeMI() in sequence.
discover_confirm(
formula,
data,
prop = 0.5,
m = 30L,
strata = NULL,
cluster = NULL,
seed = NULL,
alpha = 0.05,
mice_args = list(),
vcov_type = "HC1",
...
)
formula |
Model formula, as for |
data |
A data frame containing missing values. |
prop |
Proportion assigned to discovery. Default 0.5. |
m |
Number of imputations for each half. Default 30. |
strata |
Optional stratification column for the split. |
cluster |
Optional name of a column identifying a higher-level unit.
When given, the split keeps every unit intact on one side, the unit
identifier is excluded from the imputation model, and the confirmation
test uses a cluster-robust variance. See |
seed |
Optional integer seed. The confirmation imputation uses
|
alpha |
Nominal level for the discovery tree. Default 0.05. |
mice_args |
A list of additional arguments passed to
|
vcov_type |
Passed to |
... |
Further arguments passed to |
Imputing the halves separately is deliberate. A single imputation of the full data lets each half's outcomes inform the other's imputed predictors, and the confirmation test then no longer sees independent data. The cost is that each imputation model is fitted to half the observations. For most designs this is a reasonable trade; for small samples it may not be, and the user should judge.
An object of class "ctreeMI_dc" containing tree (the
ctreeMI fit), confirmation (a ctreeMI_confirm object), split
(the ctreeMI_split object), and the two mids objects as
imp_discover and imp_confirm.
split_holdout(), confirm_ctreeMI(), ctree_stacked()
## Not run:
set.seed(11)
n <- 800
d <- data.frame(x1 = rnorm(n), x2 = factor(sample(letters[1:3], n, TRUE)))
d$y <- rnorm(n) + 1.5 * (d$x1 > 0.3) + (d$x2 == "a")
d$x1[sample(n, 120)] <- NA
d$x2[sample(n, 80)] <- NA
res <- discover_confirm(y ~ x1 + x2, data = d, m = 20, seed = 11)
res$tree
res$confirmation
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.