Endpoint reporting summary for a fitted CTA tree
cta_endpoint_summary.RdReturns one row per terminal leaf (endpoint) with stable endpoint identifiers and stored node fields suitable for downstream reporting. All values are read directly from stored node fields; no refitting, no prediction, and no recomputation of tree metrics is performed.
Scope: This function reports structural endpoint fields only.
It does not include endpoint class counts, target-class proportions,
event rates, odds, or staging order. Per-endpoint class counts are available
via cta_endpoint_counts. Staging-table and event-rate summaries
are available via cta_staging_table.
Arguments
- tree
A
cta_treefromoda_cta_fit.
Value
A data.frame with one row per terminal leaf and columns:
endpoint_idInteger sequential index 1..n in node order.
endpoint_node_idInteger tree node identifier for this leaf, corresponding to
node_idincta_endpoint_table.pathCharacter; AND-joined branch labels from root to this leaf (e.g.
"V14<=0.5 AND V15>0.5").depthInteger depth from root (root = 1).
terminal_predictionInteger class label assigned to this endpoint (stored leaf
majority_class).n_obsInteger raw observation count at this endpoint.
n_weightedNumeric weighted observation count. Equals
n_obswhen case weights are not active (notNA).denominatorInteger endpoint denominator (equal to
n_obs); included to align with MPE/MDSA terminology.
For a no-tree fit the returned data frame has zero rows but the correct column structure and types.
Examples
data(mtcars)
X <- mtcars[, c("cyl", "disp", "hp", "wt")]
y <- as.integer(mtcars$am)
tree <- oda_cta_fit(X, y, mindenom = 5L, mc_iter = 500L, mc_seed = 42L)
cta_endpoint_summary(tree)
#> endpoint_id endpoint_node_id path depth terminal_prediction n_obs
#> 1 1 2 wt>3.18 2 1 14
#> 2 2 3 wt<=3.18 2 0 18
#> n_weighted denominator
#> 1 14 14
#> 2 18 18