
Fit Post-hoc Regime Covariance Models Across Runs
Source:R/regime-integration.R
fit_regime_covariance_runs.RdApply fit_regime_covariances() to each search/run in a named list. This is
the package analogue of the manuscript fitPosthocModels() step: the
top-level run iteration is explicit, while each run can still fit its
regime subtrees in parallel through cores.
Usage
fit_regime_covariance_runs(
x,
trait_data,
formula = trait_data ~ 1,
model = "BM",
min_tips = 2L,
cores = 1L,
error = TRUE,
tree_element = "tree_no_uncertainty_untransformed",
verbose = FALSE,
...
)Arguments
- x
Named list of
bifrost_searchobjects, compatible search-like lists, or SIMMAP-stylephylotrees. Missing or blank names are generated and names must be unique after normalization.- trait_data
Matrix or data frame with unique, non-empty row names matching the tree tip labels. Column names may be omitted; when present, they must also be unique and non-empty.
- formula
Formula used for each regime-specific
mvgls()fit. The default treatstrait_dataas the multivariate response. Formulae may refer totrait_datadirectly, as intrait_data[, 1:5] ~ trait_data[, 6], or to columns by name.- model
Evolutionary model passed to
mvMORPH::mvgls(). The default"BM"matches the independent post-hoc covariance workflow.- min_tips
Minimum number of tips required before a regime is fitted. Regimes are fitted when
tip_count >= min_tips; regimes with fewer tips are returned with status"skipped". The default of two tips matches the Berv et al. post-hoc fitting script.- cores
Number of workers. Values greater than one use
future.apply::future_lapply()with a temporary multisession plan.- error
Logical passed to
mvMORPH::mvgls().- tree_element
For search-like list inputs, the element containing the mapped tree to use for post-hoc refits. Set to
NULLto letfit_regime_covariances()resolve the tree from each run directly.- verbose
Logical; if
TRUE, print progress messages by run name.- ...
Additional arguments passed to
mvMORPH::mvgls().