Learn R Programming

The Phylogenetic Ornstein-Uhlenbeck Mixed Model

The Phylogenetic Ornstein-Uhlenbeck Mixed Model (POUMM) allows to estimate the phylogenetic heritability of a continuous trait, to test hypotheses of neutral evolution versus stabilizing selection, to quantify the strength of stabilizing selection, to estimate measurement error and to make predictions about the evolution of a phenotype and phenotypic variation in a population. The POUMM package provides an easy and efficient way to perform this variety of analyses on large macro-evolutionary or epidemic trees. It implements a fast-likelihood calculation algorithm enabling MCMC-sampling with millions of iterations within minutes on contemporary multiple core processors. The package provides functions for configuring the fit of the model and a number of standard generic functions such as logLik, plot, summary, allowing a visual and a statistical assessment of the goodness of fit. This is an important step before using the model fit to answer relevant biological questions.

Using the R-package

Here is a quick example on how to use the package on a simulated tree and trait data:

# number of tips
N <- 500 

# phylogeny
tr <- ape::rtree(N)

# for the example, simulate trait values on the tree according to a POUMM model.
z <- rVNodesGivenTreePOUMM(
  tree = tr,   
  z0 = 0,      # fixed value at the root
  alpha = 2,   # selection strength of the OU process
  theta = 3,   # long term mean of the OU process
  sigma = 1,   # unit-time standard deviation of the OU process
  sigmae = 1   # standard deviation of the non-heritable component
)[1:N]         # only the values at the N tips will be available in reality

# A combined ML and MCMC fit of the model with default parameter settings.
fit <- POUMM(z, tr)

plot(fit)
summary(fit)
AIC(fit)
BIC(fit)
coef(fit)
logLik(fit)
fitted(fit)
plot(resid(fit))
abline(h=0)

# fit PMM to the same data and do a likelihood ratio test
fitPMM <- POUMM(z, tr)
lmtest::lrtest(fitPMM, fit)

For an introduction to the model parameters and the package, read the User guide. More advanced topics, such as parametrizations and interpretations of the model fit are covered in the other package vignettes and in the package help-pages, e.g. ?POUMM, ?specifyPOUMM, ?summary.POUMM, ?plot.POUMM.

Installing the R-package

Read the section Installing the POUMM R-package in Get started.

Package source-code

The package source-code is available on github.

Licence and copyright

Copyright 2015-2020 Venelin Mitov

Source code to POUMM is made available under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. POUMM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.

Package web-page

Check-out the package web-page for the latest news and further documentation.

Copy Link

Version

Install

install.packages('POUMM')

Monthly Downloads

283

Version

2.1.7

License

GPL (>= 3.0)

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

October 27th, 2020

Functions in POUMM (2.1.7)

H2

Phylogenetic heritability estimated at time t
OU

Distribution of an Ornstein-Uhlenbeck Process at Time \(t\), Given Initial State at Time \(0\)
chld

Node indices of the direct descendants of n in the phylogeny.
coef.POUMM

Extract maximum likelihood fitted parameters (coefficients) from a fitted POUMM model.
POUMM

The Phylogenetic (Ornstein-Uhlenbeck) Mixed Model
covPOUMM

Expected covariance of two tips at given root-tip time and phylogenetic distance
dVNodesGivenTreePOUMM

Multivariate density of observed values along a tree given an OU process of evolution and root-value
covHPDFunPOUMM

A vectorized function returning HPD intervals of the expected covariance for a given tree and a fitted POUMM model
fitted.POUMM

Extract maximum likelihood expected genotypic values at the tips of a tree, to which a POUMM model has been previously fitted
likPOUMMGivenTreeVTips

Density of observed tip-values given a tree, assuming Ornstein-Uhlenbeck process for the genetic contributions along the tree and normally distributed environmental deviations.
simulateTrait

Simulate a trait on a tree under a ML fit of the POUMM model
covVTipsGivenTreePOUMM

Variance covariance matrix of the values at the tips of a tree under an OU process
specPOUMM

Specifying a POUMM fit
POUMMIsADevRelease

Check if the POUMM version correpsonds to a dev release
gPOUMM

Distribution of the genotypic values under a POUMM fit
vignetteCachedResults

Cached objects for the POUMM vignettes and examples
plot.POUMM

Plots of a POUMM-fit
edgesFrom

Edge indices of the edges in tree starting from n
plot.summary.POUMM

Plot a summary of a POUMM fit
maxLikPOUMMGivenTreeVTips

Find a maximum likelihood fit of the POUMM model
mcmcPOUMMGivenPriorTreeVTips

MCMC-sampling from a posterior distribution of a P(OU)MM model given tree, values at the tips and a prior distribution
nodeTimes

Calculate the time from the root to each node of the tree
nobs.POUMM

Number of tips in a phylogenetic tree, POUMM has been fit on.
validateSpecPOUMM

Validate a POUMM specification
likPOUMMGivenTreeVTipsC

Fast (parallel) POUMM likelihood calculation using the SPLITT library
rTrajectoryOUDef

Generation of a random trajectory of an OU process starting from a given initial state (only for test purpose)
rVNodesGivenTreePOUMM

Random generation of values along a phylogenetic tree following a branching OU process
analyseMCMCs

Extract data from an MCMC chain This is an internal function.
PhylogeneticH2

Phylogenetic Heritability
validateZTree

Validate phenotypic values and phylogenetic tree
statistics

Extract statistics from sampled or inferred parameters of a POUMM fit
summary.POUMM

Summarize the results of a POUMM-fit
loglik_abc_g0_g0Prior

Processing of the root value and calculation of the maximum log-likelihood for the given coefficients abc, and parameters theta, g0 and g0Prior. This is an internal function.
rTrajectoryOU

Generation of a random trajectory of an OU process starting from a given initial state
logLik.POUMM

Extract maximum likelihood and degrees of freedom from a fitted POUMM model
residuals.POUMM

Extract maximum likelihood environmental contributions (residuals) at the tips of a tree, to which a POUMM model has been fitted.
pruneTree

Extract information for fast likelihood calculation using the breadth-first pruning algorithm.
simulatePOUMMLikelihoodMainLoop

Writes verbose messages of the order of tree traversal during likelihood calculation
covFunPOUMM

A vectorized expected covariance function for a given tree and a fitted POUMM model