
Summarize Post-hoc Regime Covariance Models Across Runs
Source:R/regime-integration.R
summarize_regime_covariance_runs.RdApply summarize_regime_covariances() to each element returned by
fit_regime_covariance_runs(). This mirrors the manuscript
generateVarsCorsList() step while keeping rate matching, tip counts, and
high-correlation filtering explicit and reusable.
Usage
summarize_regime_covariance_runs(
x,
searches = NULL,
rates = NULL,
tree = NULL,
tip_counts = NULL,
regime_ages = NULL,
fisher_boundary = c("NA", "error"),
remove_high_corr = FALSE,
corr_threshold = 0.95
)Arguments
- x
Named list of
regime_covariancesobjects, usually fromfit_regime_covariance_runs(). Missing or blank names are generated and names must be unique after normalization.- searches
Optional named list of corresponding
bifrost_searchobjects. Run names are matched tox.- rates
Optional named list of regime-rate vectors, or one named rate vector to reuse for every run.
- tree, tip_counts, regime_ages
Optional named lists of per-run values, or a single value to reuse for every run.
- fisher_boundary
How to handle correlations with
abs(r) >= 1, where Fisher-Z is undefined."NA"returnsNAfor those regimes;"error"stops with an error.- remove_high_corr
Logical; if
TRUE, drop rows whose mean absolute correlation exceedscorr_threshold. This reproduces the manuscriptgenerateVarsCorsList(remove_high_corr = TRUE, corr_threshold = 0.95)filtering step.- corr_threshold
Correlation threshold used when
remove_high_corrisTRUE.
Examples
slow <- matrix(c(1, 0.3, 0.3, 2), nrow = 2)
fast <- matrix(c(2, 0.8, 0.8, 3), nrow = 2)
covariance_runs <- list(
first = list(slow = slow, fast = fast),
second = list(slow = slow * 1.2, fast = fast * 0.9)
)
run_summaries <- summarize_regime_covariance_runs(
covariance_runs,
rates = list(
first = c(slow = 0.8, fast = 1.6),
second = c(slow = 0.9, fast = 1.4)
)
)
run_summaries$first
#> regime rate mean_variance mean_abs_correlation fisher_z_mean_abs_correlation
#> 1 slow 0.8 1.5 0.2121320 0.2154028
#> 2 fast 1.6 2.5 0.3265986 0.3390160
#> tip_count regime_age status message
#> 1 NA NA ok <NA>
#> 2 NA NA ok <NA>