Skip to contents

Core Algorithm

Main forestsearch function and subgroup search engine.

forestsearch()
ForestSearch: Exploratory Subgroup Identification
print(<forestsearch>)
Print Method for forestsearch Objects
summary(<forestsearch>)
Summary Method for forestsearch Objects
subgroup.search()
Subgroup Search for Treatment Effect Heterogeneity (Improved, Parallelized)
get_FSdata()
ForestSearch Data Preparation and Feature Selection

Subgroup Evaluation & Selection

Functions for evaluating, sorting, and selecting candidate subgroups.

analyze_subgroup()
Analyze subgroup for summary table (OPTIMIZED)
assign_subgroup_membership()
Assign data to subgroups based on selected node
evaluate_subgroup_consistency()
Evaluate Single Subgroup for Consistency (Fixed-Sample)
extract_subgroup()
Extract Subgroup Information
get_subgroup_membership()
Get subgroup membership vector
prepare_subgroup_data()
Prepare subgroup data for analysis
select_best_subgroup()
Select best subgroup based on criterion
sort_subgroups()
Sort Subgroups by Focus
sort_subgroups_preview()
Sort Subgroups by Focus at consistency stage (consistency not available at this point)
remove_near_duplicate_subgroups()
Remove Near-Duplicate Subgroups
remove_redundant_subgroups()
Remove Redundant Subgroups

Consistency Evaluation

Split-sample consistency evaluation including the two-stage sequential method.

subgroup.consistency()
Evaluate Subgroup Consistency
evaluate_consistency_twostage()
Evaluate Consistency (Two-Stage Algorithm)
run_single_consistency_split()
Run Single Consistency Split
setup_parallel_SGcons()
Set up parallel processing for subgroup consistency
sg_consistency_out()
Output Subgroup Consistency Results
wilson_ci()
Wilson Score Confidence Interval
early_stop_decision()
Early Stopping Decision

Bootstrap Bias Correction

Bootstrap methods for bias-corrected hazard ratio estimation using infinitesimal jackknife variance estimation (Leon et al., 2024).

forestsearch_bootstrap_dofuture()
ForestSearch Bootstrap with doFuture Parallelization
bootstrap_results()
Bootstrap Results for ForestSearch with Bias Correction
bootstrap_ystar()
Bootstrap Ystar Matrix
count_boot_id()
Count ID Occurrences in Bootstrap Sample
generate_bootstrap_synthetic()
Generate Synthetic Data using Bootstrap with Perturbation
generate_bootstrap_with_noise()
Generate Bootstrap Sample with Added Noise
generate_gbsg_bootstrap_general()
Generate Synthetic GBSG Data using Generalized Bootstrap
get_dfRes()
Bootstrap Confidence Interval and Bias Correction Results

Bootstrap Summaries

Summarizing and formatting bootstrap results into publication-ready tables and diagnostics.

summarize_bootstrap_results()
Enhanced Bootstrap Results Summary
summarize_bootstrap_subgroups()
Summarize Bootstrap Subgroup Analysis Results
summarize_bootstrap_events()
Summarize Bootstrap Event Counts
summarize_factor_presence_robust()
Summarize Factor Presence Across Bootstrap Subgroups
format_bootstrap_table()
Format Bootstrap Results Table with gt
format_bootstrap_diagnostics_table()
Format Bootstrap Diagnostics Table with gt
format_bootstrap_timing_table()
Format Bootstrap Timing Table with gt
format_subgroup_summary_tables()
Format Subgroup Summary Tables with gt
create_factor_summary_tables()
Create Factor Summary Tables from Bootstrap Results

Cross-Validation

K-fold and repeated cross-validation for assessing subgroup identification stability and agreement metrics.

forestsearch_Kfold()
ForestSearch K-Fold Cross-Validation
forestsearch_tenfold()
ForestSearch Repeated K-Fold Cross-Validation
forestsearch_KfoldOut()
ForestSearch K-Fold Cross-Validation Output Summary
CV_sgs()
Cross-Validation Subgroup Match Summary
cv_summary_tables()
Create Summary Tables from forestsearch_KfoldOut Results
cv_metrics_tables()
Create Metrics Tables for Cross-Validation Results
cv_summary_text()
Create Compact CV Summary Text
cv_compare_results()
Compare Multiple CV Results
print(<fs_kfold>)
Print Method for K-Fold CV Results
print(<fs_tenfold>)
Print Method for Repeated K-Fold CV Results

GRF Integration

Generalized Random Forest methods for heterogeneous treatment effect estimation and variable importance screening.

grf.subg.harm.survival()
GRF Subgroup Identification for Survival Data
grf.subg.eval()
GRF Subgroup Evaluation and Performance Metrics
fit_causal_forest()
Fit causal survival forest
fit_policy_trees()
Fit policy trees up to specified depth
create_grf_config()
Helper Functions for GRF Subgroup Analysis
validate_grf_data()
Validate input data for GRF analysis
print_grf_details()
Print detailed output for debugging
compute_node_metrics()
Compute node metrics for a policy tree
find_leaf_split()
Find the split that leads to a specific leaf node

Cox Model Utilities

Cox proportional hazards model wrappers with robust standard errors, spline fitting, and average hazard ratio calculations.

cox_summary()
Cox model summary for subgroup (OPTIMIZED)
cox_summary_batch()
Batch Cox summaries with caching
cox_summary_legacy()
Cox model summary for subgroup
cox_summary_vectorized()
Cox model summary for subgroup - vectorized version
cox_ahr_cde_analysis()
Comprehensive Wrapper for Cox Spline Analysis with AHR and CDE Plotting
print(<cox_ahr_cde>)
Print method for cox_ahr_cde objects
summary(<cox_ahr_cde>)
Summary method for cox_ahr_cde objects
cox_cs_fit()
Fit Cox Model with Cubic Spline for Treatment Effect Heterogeneity
build_cox_formula()
Build Cox Model Formula
fit_cox_models()
Fit Cox Models for Subgroups
get_Cox_sg()
Fit Cox Model for Subgroup
get_split_hr_fast()
Fast Cox Model HR Estimation
rmst_calculation()
RMST calculation for subgroup

Subgroup Tables & Estimates

Formatted tables of subgroup estimates and labels.

sg_tables()
Enhanced Subgroup Summary Tables (gt output)
SG_tab_estimates()
Subgroup summary table estimates
SGplot_estimates()
Violin/Boxplot Visualization of HR Estimates
FS_labels()
Convert Factor Code to Label
create_summary_table()
Create Enhanced Summary Table for Baseline Characteristics
create_summary_table_compact()
Preset: Compact Table
create_summary_table_minimal()
Preset: Minimal Table (No Highlighting, No Alternating)
create_summary_table_presentation()
Preset: Presentation Table (Large Fonts)
create_summary_table_publication()
Preset: Publication-Ready Table
create_sample_size_table()
Create Sample Size Table for Multiple Scenarios

Visualization

Publication-ready plotting functions for forest plots, survival curves, and subgroup characteristics.

gg_forest()
ggplot2 / patchwork forest plot
plot_subgroup_results_forestplot()
Plot Subgroup Results Forest Plot
render_forestplot()
Render ForestSearch Forest Plot
save_forestplot()
Save ForestSearch Forest Plot to File
create_forest_theme()
Create Forest Plot Theme with Size Controls
print(<fs_forest_theme>)
Print Method for ForestSearch Forest Theme
print(<fs_forestplot>)
Print Method for ForestSearch Forest Plot
plot(<fs_forestplot>)
Plot Method for ForestSearch Forest Plot
create_subgroup_summary_df()
Create Subgroup Summary Data Frame for Forest Plot
plot_km_band_forestsearch()
Plot Kaplan-Meier Survival Difference Bands for ForestSearch Subgroups
quick_km_band_plot()
Quick Plot KM Bands from ForestSearch
plot_sg_results()
Plot ForestSearch Subgroup Results
plot_sg_weighted_km()
Plot Weighted Kaplan-Meier Curves for ForestSearch Subgroups
print(<fs_weighted_km>)
Print Method for fs_weighted_km Objects
plot_subgroup()
Plot Subgroup Survival Curves
plot(<fs_sg_plot>)
Plot Method for fs_sg_plot Objects
print(<fs_sg_plot>)
Print Method for fs_sg_plot Objects
plot_subgroup_effects()
Plot Subgroup Analysis Results
plot(<forestsearch>)
Plot ForestSearch Results
plot_spline_treatment_effect()
Plot Spline Treatment Effect Function
plot_detection_curve()
Plot Detection Probability Curve
compare_detection_curves()
Compare Detection Curves Across Sample Sizes
sens_text()
Generate Cross-Validation Sensitivity Text
figure_note()
Generate Figure Note for Quarto/RMarkdown
km_summary()
KM median summary for subgroup

Data Preparation & Encoding

Cut point generation, dummy variable creation, and variable selection.

get_dfpred()
Generate Prediction Dataset with Subgroup Treatment Recommendation
dummy_encode()
Dummy-code a data frame (numeric pass-through, factors expanded)
add_id_column()
Add ID Column to Data Frame
evaluate_comparison()
Evaluate a Comparison Expression Without eval(parse())
evaluate_cuts_once()
Cache and validate cut expressions efficiently
detect_variable_types()
Automatically Detect Variable Types in a Dataset
is_flag_continuous()
Check if cut expression is for a continuous variable (OPTIMIZED)
is_flag_drop()
Check if cut expression should be dropped
is.continuous()
Check if a variable is continuous
get_cut_name()
Get variable name from cut expression
cut_var()
Generate cut expressions for a variable
lasso_selection()
LASSO selection for Cox model
filter_by_lassokeep()
Filter a vector by LASSO-selected variables

Tree Cut Extraction

Extract and process cut points from tree-based models.

extract_all_tree_cuts()
Extract all cuts from fitted trees
extract_selected_tree_cuts()
Extract cuts from selected tree only
extract_tree_cuts()
Extract cut information from a policy tree
extract_idx_flagredundancy()
Extract redundancy flag for subgroup combinations

Data Generating Mechanisms

Functions for creating data generating mechanisms (DGMs) for simulation studies with configurable treatment effect heterogeneity.

generate_aft_dgm_flex()
Generate Synthetic Survival Data using AFT Model with Flexible Subgroups
create_gbsg_dgm()
Create GBSG-Based AFT Data Generating Mechanism
print(<gbsg_dgm>)
Print Method for gbsg_dgm Objects
compute_dgm_cde()
Compute and Attach CDE Values to a DGM Object
create_dgm_for_mrct()
Create Data Generating Mechanism for MRCT Simulations
simulate_from_dgm()
Simulate Survival Data from AFT Data Generating Mechanism
simulate_from_gbsg_dgm()
Simulate Trial Data from GBSG DGM
get_dgm_with_output()
Create DGM with Output File Path
calibrate_cens_adjust()
Calibrate Censoring Adjustment to Match DGM Reference Distribution
check_censoring_dgm()
Diagnose Censoring Consistency Between DGM Source Data and Simulated Data
calibrate_k_inter()
Calibrate k_inter for Target Subgroup Hazard Ratio
find_k_inter_for_target_hr()
Find k_inter Value to Achieve Target Harm Subgroup Hazard Ratio
validate_k_inter_effect()
Validate k_inter Effect on HR Heterogeneity
sensitivity_analysis_k_inter()
Sensitivity Analysis of Hazard Ratios to k_inter

Simulation Studies

Running and summarizing simulation studies for operating characteristics.

run_simulation_analysis()
Run Single Simulation Analysis
default_fs_params()
Default ForestSearch Parameters for GBSG Simulations
default_grf_params()
Default GRF Parameters for GBSG Simulations
summarize_simulation_results()
Summarize Simulation Results
format_oc_results()
Format Operating Characteristics Results as GT Table
build_classification_table()
Build Classification Rate Table from Simulation Results
build_estimation_table()
Build Estimation Properties Table from Simulation Results
interpret_estimation_table()
Generate Narrative Interpretation of Estimation Properties
render_reference_table()
Render Reference Simulation Table as gt
compute_detection_probability()
Compute Probability of Detecting True Subgroup
generate_detection_curve()
Generate Detection Probability Curve
find_required_sample_size()
Find Minimum Sample Size for Target Detection Power
create_null_result()
Create result object when no subgroup is found
create_success_result()
Create result object for successful subgroup identification

Multi-Regional Clinical Trials

Specialized functions for multi-regional clinical trial (MRCT) subgroup analysis with regional consistency evaluation.

mrct_region_sims()
MRCT Regional Subgroup Simulation
summaryout_mrct()
Summary Tables for MRCT Simulation Results
validate_mrct_data()
Validate Dataset for MRCT Simulations

Formatting & Estimation Helpers

Formatting utilities, confidence intervals, and estimation helpers.

format_CI()
Format Confidence Interval for Estimates
format_results()
Format results for subgroup summary
hrCI_format()
Format Hazard Ratio and Confidence Interval
n_pcnt()
Calculate n and percent
ci_est()
Confidence Interval for Estimate
calc_cov()
Calculate Covariance for Bootstrap Estimates
get_targetEst()
Target Estimate and Standard Error for Bootstrap
calculate_counts()
Calculate counts for subgroup summary
calculate_potential_hr()
Calculate potential outcome hazard ratio
density_threshold_both()
Bivariate Density for Split-Sample HR Threshold Detection
find_quantile_for_proportion()
Find Quantile for Target Subgroup Proportion
qlow()
25th Percentile (Quantile Low)
qhigh()
75th Percentile (Quantile High)
get_best_survreg()
Get Best Model from Comparison
compare_multiple_survreg()
Compare Multiple Survival Regression Models
print(<multi_survreg_comparison>)
Print method for survreg_comparison objects

Internal Utilities

Lower-level helpers. Most users will not call these directly.

filter_call_args()
Filter and merge arguments for function calls
get_combinations_info()
Get all combinations of subgroup factors up to maxk
get_conf_force()
Get forced cut expressions for variables
get_covs_in()
Get indicator vector for selected subgroup factors
process_conf_force_expr()
Process forced cut expression for a variable