Skip to contents

Computes propensity weights from the terminal strata of a fitted LORT (Locally Optimal Recursive Tree) model. Uses stored class_counts per terminal node. Implements the Yarnold/Linden stratum-weight formula (same as cta_propensity_weights): $$w = n_s \times \Pr(Z=z) / n_{z,s}$$

Usage

lort_propensity_weights(ort, target_class = NULL, adjusted = TRUE)

Arguments

ort

A cta_ort object produced by lort_fit or cta_fit(recursive = TRUE).

target_class

Integer target class for annotation (optional; if NULL, defaults to the numerically higher class in binary models).

adjusted

Logical; if TRUE (default), applies a one-hypothetical-misclassification adjustment when a class is absent from a terminal stratum.

Value

Data frame with one row per (stratum, class) combination. Columns: stratum_id (integer), path (character), depth (integer), stratum_n (integer), terminal_class (integer), class (character), class_n (integer), target_class (integer), marginal_class_n (integer), marginal_total_n (integer), marginal_class_probability (numeric), propensity_weight (numeric), undefined_empirical (logical), adjusted (logical), adjusted_propensity_weight (numeric), model_family ("lort"), global_optimization (FALSE), sda_anchored (FALSE).

Details

The fitted model must have been trained with the treatment/exposure/group membership as the class variable, not a clinical outcome. The user is responsible for this labeling decision.