View source: R/ctree_stacked.R
| ctree_stacked | R Documentation |
Fits a conditional inference tree (ctree) on stacked multiply
imputed datasets using the Stack / M rescaling procedure described in
Sherlock et al. (2026). Multiply imputed datasets are concatenated
vertically ("stacked"), and the significance threshold used for
node-level pruning is divided by the number of imputations M to
counteract the artificially inflated sample size. This yields a single,
coherent, interpretable tree that incorporates imputation variability
without requiring the pooling of structurally different trees.
ctree_stacked(formula, data, m = NULL, alpha = 0.05, verbose = TRUE, ...)
formula |
A model formula, passed to |
data |
A |
m |
Integer. Number of imputations to use. Defaults to all
available datasets. Ignored when |
alpha |
Numeric. Nominal significance threshold for node-level
splitting (default |
verbose |
Logical. If |
... |
Additional arguments passed to
|
Methodological background
Conditional inference trees (Hothorn, Hornik & Zeileis, 2006) use permutation-based significance tests to select splits, providing built-in protection against spurious partitioning. When data are multiply imputed, pooling trees fitted to separate imputations is infeasible: structurally different trees define different subgroups, making the targets of inference incomparable across imputations.
Rodgers et al. (2021) proposed stacking the M imputed datasets
and fitting a single tree to the combined data. This produces one
coherent, interpretable tree. The complication is that stacking inflates
the nominal sample size by M, causing test statistics at each
node to be similarly inflated.
Sherlock et al. (2026) proposed and validated the Stack / M
correction: use a significance threshold of alpha / M. Monte
Carlo simulations under MCAR confirmed sub-nominal (conservative)
type-I error and acceptable power, making this approach well-suited for
exploratory analyses where interpretability is prioritised.
An object of class c("ctreeMI", "constparty", "party").
All partykit methods (plot, predict, etc.) work on
this object. An additional ctreeMI_info attribute carries:
mNumber of imputations used.
n_originalRows in one imputed dataset.
n_stackedTotal rows in the stacked dataset (M \times n).
alpha_nominalNominal alpha supplied by the user.
alpha_appliedCorrected alpha applied (alpha / m).
formulaThe model formula.
callThe matched call.
Node-level sample sizes reported by print() and plot()
reflect the stacked dataset. Divide by M to obtain effective
per-node counts in the original data.
Sherlock, P., Mansolf, M., Hofheimer, J., Hockett, C. W., O'Connor, T. G., Roubinov, D., Graff, J. C., Lai, J.-S., Bush, N. R., Wright, R. J., & Chiu, Y.-H. M. (2026). Beyond linear risk: A machine learning approach to understanding perinatal depression in context. Multivariate Behavioral Research, 1–16. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/00273171.2026.2661244")}
Hothorn, T., Hornik, K., & Zeileis, A. (2006). Unbiased recursive partitioning: A conditional inference framework. Journal of Computational and Graphical Statistics, 15(3), 651–674. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1198/106186006X133933")}
Hothorn, T., & Zeileis, A. (2015). partykit: A modular toolkit for recursive partitioning in R. Journal of Machine Learning Research, 16, 3905–3909.
Rodgers, J., Khoo, S.-T., & Ludtke, O. (2021). Handling missing data in structural equation models using multiple imputation and stacking. Structural Equation Modeling, 28(6), 915–930.
ctree,
ctree_control,
mice,
stack_imputations,
rescale_alpha,
print.ctreeMI,
summary.ctreeMI
library(mice)
# Introduce missingness into the airquality dataset
set.seed(42)
aq <- airquality
aq$Ozone[sample(nrow(aq), 20)] <- NA
aq$Solar.R[sample(nrow(aq), 15)] <- NA
# Impute (M = 20)
imp <- mice(aq, m = 20, printFlag = FALSE)
# Fit ctree with Stack/M correction
fit <- ctree_stacked(Ozone ~ Solar.R + Wind + Temp + Month,
data = imp,
alpha = 0.05)
print(fit)
plot(fit)
# Example using a list of data frames (no mice required)
set.seed(1)
make_df <- function(i) {
set.seed(i)
n <- 100
x1 <- rnorm(n)
y <- x1 + rnorm(n)
data.frame(y = y, x1 = x1)
}
imp_list <- lapply(1:10, make_df)
fit <- ctree_stacked(y ~ x1, data = imp_list, alpha = 0.05, verbose = FALSE)
print(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.