Skip to contents

Returns a data frame with one row per node, mirroring the CTA.exe-style node report (ATTRIBUTE, NODE, LEV, OBS, p, ESS/WESS, LOO, WESSL/LOO ESS, LOOp, TYP, MODEL columns).

Split nodes carry canonical split metrics (ESS, WESS, p, LOO status, LOO ESS/WESSL, LOOp) and a MODEL field with branch strings and terminal-leaf * markers. Leaf rows have NA for all split metrics and MODEL.

Usage

cta_node_table(tree)

Arguments

tree

A cta_tree from oda_cta_fit.

Value

Data frame with columns:

node_id

Integer node identifier.

parent_id

Integer parent node identifier (0 for root).

level

Integer level from root (root = 1); alias for depth.

depth

Integer depth from root (root = 1).

leaf

Logical; TRUE for terminal leaf nodes.

attribute

Character attribute name (NA for leaves).

attr_type

Character attribute type (NA for leaves).

n_obs

Integer observation count at this node.

n_weighted

Numeric weighted observation count.

p_mc

Numeric Monte Carlo p-value (NA for leaves).

ess

Numeric ESS at this split (NA for leaves).

ess_weighted

Numeric WESS at this split (NA for leaves); equals ess when case weights are not active.

loo_status

Character LOO status, e.g. "STABLE" (NA for leaves).

loo_ess

Numeric LOO ESS/WESSL (NA for leaves).

loo_p

Numeric LOO p-value (NA for leaves).

model

Character CTA.exe-style branch string with terminal-leaf * markers, e.g. "<=0.5-->0,101/131,77.10%*; >0.5-->1,21/55,38.18%*". NA for leaf nodes.