get_mean_var_shifts {ShiVa} | R Documentation |
Estimate Shifts in Optimal Trait Values and Variance
Description
Estimates shifts in both the optimal trait values (mean) and evolutionary variance along a phylogeny under an Ornstein-Uhlenbeck (OU) process, using an \ell_1
-penalized optimization procedure. Optionally accounts for measurement error in the observed trait data.
Usage
get_mean_var_shifts(
Y,
tree,
alpha,
lambda1,
lambda2,
max.steps = 1000,
t = 0.01,
penalty = "L1",
thres = 0.01,
sigma2 = NULL,
measurement_error = FALSE
)
Arguments
Y |
A numeric vector of continuous trait values for the species at the tips of the tree. |
tree |
A phylogenetic tree of class |
alpha |
The selection strength parameter in the OU process. |
lambda1 |
Non-negative penalty for |
lambda2 |
Non-negative penalty for |
max.steps |
Maximum number of optimization steps. Default is 1000. |
t |
Step size for the gradient-based updates. Default is 0.01. |
penalty |
Type of penalty to apply. Options are |
thres |
Convergence threshold for the change in loss between steps. Default is 0.01. |
sigma2 |
Optional initial value for the base evolutionary variance. If |
measurement_error |
Logical. If |
Value
A list containing:
shifts_mean |
Indices of branches with detected shifts in optimal trait values ( |
shifts_var |
Indices of branches with detected shifts in evolutionary variance ( |
beta |
Estimated shift coefficients for optimal trait values. |
gamma |
Estimated shift coefficients for evolutionary variance. |
sigma2 |
Estimated base variance ( |
b0 |
Estimated intercept (root state). |
sigma2_error |
Estimated measurement error variance (only returned if |