node_table: Terminal-Node Summary With Effective Sample Sizes

View source: R/node_table.R

node_tableR Documentation

Terminal-Node Summary With Effective Sample Sizes

Description

Summarizes the nodes of a fitted tree: the split path leading to each node, its size in the stacked data, its effective size in original observations (stacked size divided by M), and node-level outcome summaries.

Usage

node_table(object, terminal_only = TRUE, max_levels = NULL, digits = 3)

Arguments

object

A ctreeMI object from ctree_stacked(), or any party object (in which case M is taken to be 1).

terminal_only

Logical. Report terminal nodes only (default), or every node including the root.

max_levels

Integer or NULL. Truncate factor level sets longer than this in the printed split path.

digits

Number of digits for the outcome summaries.

Details

Terminal-node sample sizes printed by partykit refer to the stacked data, in which every observation appears M times. effective_n divides by M to give the number of original observations behind each node. Node-level means and proportions need no such adjustment: they are already averages over the imputations.

Value

A data frame of class "ctreeMI_nodes" with one row per node: node_id, depth, n_stacked, effective_n, any outcome summaries, path, and a conditions list column holding the split conditions individually.

See Also

ctree_stacked(), report_ctreeMI()

Examples

set.seed(1)
imps <- lapply(1:5, function(i) {
  x <- stats::rnorm(200)
  data.frame(x = x, y = stats::rnorm(200) + 1.5 * (x > 0))
})
fit <- ctree_stacked(y ~ x, data = imps, verbose = FALSE)
node_table(fit)


ctreeMI documentation built on Oct. 12, 2026, 5:08 p.m.