Skip to contents

Returns one row per LORT node from a cta_ort (LORT) object. Each row exposes the embedded CTA member selected at that node (MINDENOM, ESS, D, root attribute, split/leaf counts, endpoint count) plus the LORT method taxonomy metadata (method, selection_scope, global_optimization, sda_anchored).

Terminal nodes have NA for all selected-model columns. Non-terminal nodes have NA for stop_reason and non-empty child_ids.

Naming note: The function name cta_ort_node_table and the class cta_ort are legacy compatibility names for the implemented LORT method. They are retained for backward compatibility; new code and documentation should refer to the method as LORT.

Usage

cta_ort_node_table(object)

Arguments

object

A cta_ort from cta_fit(..., recursive = TRUE).

Value

A data.frame with one row per ORT node and columns:

ort_node_id

Integer ORT node identifier.

parent_ort_node_id

Integer parent ORT node id; NA for root.

depth

Integer recursion depth (root = 0).

n

Integer observations at this ORT node.

class_counts

Character; named class counts, e.g. "0=60, 1=40".

terminal

Logical; TRUE for terminal leaf ORT nodes.

stop_reason

Character stop reason for terminal nodes; NA for non-terminal.

selected_mindenom

Integer MINDENOM of the embedded CTA member.

selected_ess

Numeric ESS of the embedded CTA member (%).

selected_d

Numeric D-statistic of the embedded CTA member.

selected_root_attribute

Character root attribute of the embedded CTA member.

selected_tree_nodes

Integer split-node count in the embedded CTA member.

selected_tree_leaves

Integer leaf count in the embedded CTA member.

selected_endpoint_count

Integer endpoint (terminal leaf) count of the embedded CTA member; equals number of ORT child nodes.

child_ids

Character comma-separated child ORT node ids; empty string for terminal nodes.

method

Character; always "lort" for current fits.

selection_scope

Character; always "local_node" for LORT.

global_optimization

Logical; always FALSE for LORT.

sda_anchored

Logical; always FALSE for LORT.

Examples

X <- data.frame(A = c(rep(0L, 20), rep(1L, 20), rep(1L, 20)),
                B = c(rep(0L, 20), rep(0L, 20), rep(1L, 20)))
y <- c(rep(0L, 20), rep(0L, 20), rep(1L, 20))
ort <- cta_fit(X, y, recursive = TRUE, mc_iter = 100L, mc_seed = 42L,
               loo = "off", min_n = 5L)
cta_ort_node_table(ort)
#>   ort_node_id parent_ort_node_id depth  n class_counts terminal stop_reason
#> 1           1                 NA     0 60   0=40, 1=20    FALSE        <NA>
#> 2           2                  1     1 20         1=20     TRUE     no_tree
#> 3           3                  1     1 20         0=20     TRUE     no_tree
#> 4           4                  1     1 20         0=20     TRUE     no_tree
#>   selected_mindenom selected_ess selected_d selected_root_attribute
#> 1                 1          100          0                       A
#> 2                NA           NA         NA                    <NA>
#> 3                NA           NA         NA                    <NA>
#> 4                NA           NA         NA                    <NA>
#>   selected_tree_nodes selected_tree_leaves selected_endpoint_count child_ids
#> 1                   4                    3                       3     4,3,2
#> 2                  NA                   NA                      NA          
#> 3                  NA                   NA                      NA          
#> 4                  NA                   NA                      NA          
#>   method selection_scope global_optimization sda_anchored
#> 1   lort      local_node               FALSE        FALSE
#> 2   lort      local_node               FALSE        FALSE
#> 3   lort      local_node               FALSE        FALSE
#> 4   lort      local_node               FALSE        FALSE