ShiVa {ShiVa} | R Documentation |
ShiVa: Automatic Shift Detection in Mean and Variance
Description
Performs automatic detection of evolutionary shifts in both optimal trait values (mean) and diffusion variance under an Ornstein-Uhlenbeck (OU) process. This function serves as a wrapper for get_mean_var_shifts_model_selection
, with the added ability to automatically estimate the selection strength parameter alpha
if not provided.
Usage
ShiVa(
Y,
tree,
alpha = NULL,
t = 0.01,
lambda1_list = NULL,
lambda2_list = exp(1:10 * 0.4 - 6),
criterion = "BIC",
max.steps = 300,
nfolds = 8,
top_k = 10,
measurement_error = FALSE,
lambda.type = "lambda.1se",
max.num.shifts = Inf
)
Arguments
Y |
A numeric vector of trait values at the tips of the phylogenetic tree. |
tree |
A phylogenetic tree of class |
alpha |
(Optional) A non-negative numeric value specifying the OU selection strength. If |
t |
Step size for optimization. Default is 0.01. |
lambda1_list |
A numeric vector of candidate |
lambda2_list |
A numeric vector of candidate |
criterion |
Model selection criterion to use. Options are |
max.steps |
Maximum number of optimization steps. Default is 300. |
nfolds |
Number of folds for cross-validation in tuning |
top_k |
Number of top candidate models (based on criterion) to refine using backward correction. Default is 10. |
measurement_error |
Logical. If |
lambda.type |
Cross-validation rule for selecting |
max.num.shifts |
Maximum number of allowed shifts (in both mean and variance). Default is |
Value
A list with the same structure as get_mean_var_shifts_model_selection
:
best_model |
The final selected OU model object. |
score_summary |
A data frame summarizing candidate models and backward-corrected scores. |