Fits an Ornstein-Uhlenbeck (OU) model with user-specified shifts in both optimal trait values (mean) and evolutionary variance along a phylogeny. The method uses numerical optimization to estimate shift magnitudes, base variance, and intercept, and can optionally incorporate measurement error in trait values.
fit_OU_mean_var(
tree,
Y,
alpha,
shifts_mean,
shifts_var,
max.steps = 1000,
t = 0.01,
thres = 0.01,
measurement_error = FALSE,
max.num.shifts = Inf
)
A list containing:
The phylogenetic tree.
The trait values.
Indices of branches with non-zero shifts in optimal trait value.
Indices of branches with non-zero shifts in evolutionary variance.
Estimated shift magnitudes for optima values.
Estimated shift magnitudes for variance.
Estimated base evolutionary variance.
Estimated intercept (ancestral trait value).
Estimated measurement error variance (only returned if measurement_error = TRUE
).
Log-likelihood of the fitted model.
BBIC for model selection.
mBIC for accounting shift sparsity and shared support.
pBIC incorporating determinant of projected design matrix.
Fitted trait values based on the estimated model.
Estimated trait covariance matrix under the fitted model.
A phylogenetic tree of class phylo
.
A numeric vector of continuous trait values at the tips of the tree.
A non-negative numeric value specifying the strength of selection in the OU process.
An integer vector indicating the indices of branches where shifts in the optimal trait value occur.
An integer vector indicating the indices of branches where shifts in evolutionary variance occur.
Maximum number of optimization steps. Default is 1000.
Step size for the optimizer. Default is 0.01.
Convergence threshold for change in log-likelihood. Default is 0.01.
Logical. If TRUE
, a separate measurement error variance is estimated and added to the diagonal of the covariance matrix.
Maximum allowed number of shifts (combined for mean and variance). Default is Inf
.