backward_correction {ShiVa} | R Documentation |
Backward Selection for OU Model Shift Correction
Description
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.
Usage
backward_correction(
tree,
Y,
alpha,
shifts_mean,
shifts_var,
criterion = "BIC",
original_model = NULL,
measurement_error = FALSE,
max.num.shifts = Inf
)
Arguments
tree |
A phylogenetic tree of class |
Y |
A numeric vector of trait values corresponding to the tips of the tree. |
alpha |
A non-negative numeric value specifying the strength of selection in the OU process. |
shifts_mean |
A vector of branch indices with candidate shifts in optimal trait values. |
shifts_var |
A vector of branch indices with candidate shifts in evolutionary variance. |
criterion |
A model selection criterion to guide backward elimination. Options include |
original_model |
(Optional) A previously fitted OU model returned by |
measurement_error |
Logical. If |
max.num.shifts |
An integer specifying the maximum number of total shifts (mean and variance combined) allowed in the model. Default is |
Value
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.