summarize_bootstrap_subgroups: Summarize Bootstrap Subgroup Analysis Results

View source: R/summarize_bootstrap_subgroups.R

summarize_bootstrap_subgroupsR Documentation

Summarize Bootstrap Subgroup Analysis Results

Description

Comprehensive tabulation of bootstrap subgroup identification results including basic statistics, factor frequencies, consistency distributions, GRF-cut frequencies, and agreement with the original analysis subgroup. Returns raw data.table tabulations suitable for custom post-processing, export, or plotting; for the full formatted pipeline (gt tables, diagnostics, plots) call summarize_bootstrap_results instead.

Usage

summarize_bootstrap_subgroups(results, nb_boots, original_sg = NULL, maxk = 2)

Arguments

results

Data.table or data.frame. Bootstrap results with subgroup characteristics including columns like Pcons, hr_sg, N_sg, K_sg, and M.1-M.k

nb_boots

Integer. Total number of bootstrap iterations

original_sg

Character vector. Original subgroup definition from main analysis (e.g., c("{age>=50}", "{nodes>=3}") for a 2-factor subgroup)

maxk

Integer. Maximum number of factors allowed in subgroup definition

Value

List with summary components:

basic_stats

Data.table of summary statistics

consistency_dist

Data.table of Pcons distribution by bins (columns Consistency Range, Count, Percent = 100 * Count / n_found). The bins are closed on the left: a label "a-b" holds a <= Pcons < b (for example "0.85-0.95" holds 0.85 <= Pcons < 0.95), "<0.5" holds Pcons < 0.5, and the top bin ">=0.95" holds 0.95 <= Pcons <= 1. A value on a break counts in the bin that starts there (0.95 is in ">=0.95").

size_dist

Data.table of subgroup size distribution (columns Size Range, Count, Percent), with bins closed on the left in the same way: "<50" holds N_sg < 50, "50-99" holds 50 <= N_sg < 100, and so on to ">=300", which holds N_sg >= 300.

factor_freq

Data.table of factor frequencies by position

agreement

Data.table of subgroup definition agreement counts

factor_presence

Data.table of base factor presence counts

factor_presence_specific

Data.table of specific factor definitions

grf_cut_freq

Data.table of GRF policy-tree cut frequencies across all bootstrap iterations (not just successful ones). Columns: Rank, grf_cut, N, Percent. NULL when results lacks the grf_cuts_b column (pre-Phase-C objects). Unlike subgroup-related tables, this tabulation is NOT restricted to iterations that identified a subgroup – it spans all bootstraps so that the analyst can distinguish "GRF produced no cut" from "GRF produced a cut that consistency rejected".

original_agreement

Data.table comparing to original analysis subgroup

n_found

Integer. Number of successful iterations

pct_found

Numeric. Percentage of successful iterations

See Also

summarize_bootstrap_results for the full formatted summary pipeline (gt tables plus diagnostics and plots). forestsearch_bootstrap_dofuture to run the bootstrap analysis that produces the results object consumed here.

Examples

## Not run: 
# Run bootstrap analysis
boot_out <- forestsearch_bootstrap_dofuture(fs.est, nb_boots = 500)

# Raw tabulations for custom post-processing
subg <- summarize_bootstrap_subgroups(
  results     = boot_out$results,
  nb_boots    = 500,
  original_sg = fs.est$sg.harm,
  maxk        = 2L
)

# Inspect the GRF cut frequencies across all bootstraps
subg$grf_cut_freq

# Export factor frequencies to CSV for an external report
data.table::fwrite(subg$factor_freq, "factor_freq.csv")

## End(Not run)


forestsearch documentation built on Nov. 15, 2026, 9:06 a.m.