Learn R Programming

ShiVa: Detection of Evolutionary Shifts in both Optimal Value and Variance

Version: 1.0.1
Authors:

Overview

ShiVa is an R package for detecting evolutionary shifts in both optimal trait values (mean) and diffusion variance across phylogenetic trees, based on the Ornstein-Uhlenbeck (OU) model. While many existing methods detect shifts in optimal values only, ShiVa simultaneously identifies both types of shifts using a penalized likelihood framework with L1 regularization.

The method is designed for researchers in evolutionary biology and comparative methods, particularly those interested in identifying abrupt regime changes along a phylogeny.

See our preprint for methodological details: arXiv:2312.17480

Features

  • Automatively estimates shifts in both mean (θ) and variance (σ²) under the OU model
  • Supports model selection using BIC, mBIC, or pBIC
  • Includes backward correction for improved parsimony
  • Can optionally account for measurement error
  • Fast optimization using coordinate descent and soft-thresholding

Installation

To install the package from GitHub:

# install.packages("devtools") # if not already installed
devtools::install_github("WenshaZ/ShiVa")

Copy Link

Version

Install

install.packages('ShiVa')

Version

1.0.1

License

GPL (>= 3)

Maintainer

Wensha Zhang

Last Published

July 22nd, 2025

Functions in ShiVa (1.0.1)

generate_design_matrix

Generate Design Matrix
OU.vcv

OU.vcv
soft_thresholding

Soft Thresholding
get_mean_var_shifts_model_selection

Model Selection for OU Shifts in Optimal value and Variance
backward_correction

Backward Selection for OU Model Shift Correction
print.summary.ShiftModel

Print Method for Summary of ShiftModel
fit_OU_mean_var

Fit OU Model with Shifts in Mean and Variance
summary.ShiftModel

Summary of a ShiVa Shift Model
plot.ShiftModel

Plot Method for ShiftModel Objects
update_step_gamma

Update Step for Gamma
get_mean_var_shifts

Estimate Shifts in Optimal Trait Values and Variance
ShiVa

ShiVa: Automatic Shift Detection in Mean and Variance