Performs backward stepwise selection on a given set of candidate shifts in optimal trait values (mean) and evolutionary variance under an Ornstein-Uhlenbeck (OU) model. This function iteratively removes individual shifts to improve model fit based on a specified selection criterion.
backward_correction(
tree,
Y,
alpha,
shifts_mean,
shifts_var,
criterion = "BIC",
original_model = NULL,
measurement_error = FALSE,
max.num.shifts = Inf
)
A fitted OU model object (a list), as returned by fit_OU_mean_var
, with a potentially reduced set of shifts that minimizes the specified criterion.
A phylogenetic tree of class phylo
.
A numeric vector of trait values corresponding to the tips of the tree.
A non-negative numeric value specifying the strength of selection in the OU process.
A vector of branch indices with candidate shifts in optimal trait values.
A vector of branch indices with candidate shifts in evolutionary variance.
A model selection criterion to guide backward elimination. Options include "BIC"
, "mBIC"
, or "pBIC"
. Default is "BIC"
.
(Optional) A previously fitted OU model returned by fit_OU_mean_var
. If NULL
, the model is refit using the provided shifts.
Logical. If TRUE
, the model accounts for measurement error by estimating an additional variance term. Default is FALSE
.
An integer specifying the maximum number of total shifts (mean and variance combined) allowed in the model. Default is Inf
.