Learn R Programming

OUwie is an R package for using Brownian motion and Ornstein-Uhlenbeck models for trait evolution. Its friendly webpage is at http://thej022214.github.io/OUwie/; its source code is at https://github.com/thej022214/OUwie/.

Some of the features:

  • Brownian motion models that allow the rate (sigma-squared) to vary over the tree
  • Ornstein-Uhlenbeck models that allow the rate, optima (theta), and/or strength of pull (alpha) to vary over the tree
  • Uncertainty estimation using contour plots to find potential ridges
  • Simulation functions
  • Automatic testing of some identifiability issues using methods from Ho and Ané (2014)
  • Ancestral state estimation under all these models (though use substantial caution)
  • Use of measurement error at the tips

Some of its caveats:

  • It is univariate (a single trait) only
  • For multiple rate models, it requires some mapping of regimes (stochastic character mapping of a discrete state, using node labels for regimes on trees, etc.).
  • It warns you about models that are very complex for what your data may allow, but it will let you run them
  • Optimization can be a difficult problem -- it tries its best, and will announce failures when it notices them, but still be careful

This is the bleeding edge version: you can install it with remotes::install_github("thej022214/OUwie") [install the remotes package from CRAN first]

Copy Link

Version

Install

install.packages('OUwie')

Monthly Downloads

992

Version

3.0.3

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Jeremy Beaulieu

Last Published

September 16th, 2026

Functions in OUwie (3.0.3)

dent_likelihood

Dents the likelihood surface This takes any values that are better (lower) than the desired negative log likelihood and reflects them across the best_neglnL + delta line, "denting" the likelihood surface.
dent_walk

Sample points from along a ridge This "dents" the likelihood surface by reflecting points better than a threshold back across the threshold (think of taking a hollow plastic model of a mountain and punching the top so it's a volcano). It then uses essentially a Metropolis-Hastings walk to wander around the new rim. It adjusts the proposal width so that it samples points around the desired likelihood. This is better than using the curvature at the maximum likelihood estimate since it can actually sample points in case the assumptions of the curvature method do not hold. It is better than varying one parameter at a time while holding others constant because that could miss ridges: if I am fitting 5=x+y, and get a point estimate of (3,2), the reality is that there are an infinite range of values of x and y that will sum to 5, but if I hold x constant it looks like y is estimated very precisely. Of course, one could just fully embrace the Metropolis-Hastings lifestyle and use a full Bayesian approach.
hOUwie.fixed

Fit a joint model of discrete and continuous characters via maximum-likelihood with fixed regimes.
getOUParamStructure

Generate a continuous model parameter structure
dent_propose

Propose new values This proposes new values using a normal distribution centered on the original parameter values, with desired standard deviation. If any proposed values are outside the bounds, it will propose again.
fix.kappa

Adjust tree for matrix condition
getModelAvgParams

Model average the parameter estimates over severl hOUwie fits.
hOUwie.recon

Reconstruct the marginal probability of discrete node states under the hOUwie model.
hOUwie

Fit a joint model of discrete and continuous characters via maximum-likelihood.
hOUwie.walk

Sample points from along a ridge for a hOUwie model
plot.dentist

Plot the dented samples This will show the univariate plots of the parameter values versus the likelihood as well as bivariate plots of pairs of parameters to look for ridges.
hOUwie.sim

Simulate a discrete and continuous character following a Markov and Ornstein-Uhlenbeck model.
plot.OUwie.contour

Contour plot
hOUwie.thorough

Rerun a set of hOUwie models with the best mappings of the set.
print.dentist

Print dentist print summary of output from dent_walk
summary.dentist

Summarize dentist Display summary of output from dent_walk
getModelTable

Generate a table from a set of hOUwie models describing their relative fit to data.
Example

An example dataset
OUwie.sim

Generalized Hansen model simulator
OUwie.format

Format data and tree for OUwie
OUwie.dredge

Generalized Detection of shifts in OU process
OUwie.anc

Estimate ancestral states given a fitted OUwie model
OUwie.contour

Generates data for contour plot of likelihood surface
OUwie.fixed

Generalized Hansen model likelihood calculator
check.identify

A test of regime identifiability
OUwie.boot

Parametric bootstrap function
OUwie

Generalized Hansen models