Multivariate models
Traits are rarely changing independently of each other due to shared genetics or development. Evolution is accordingly a multivariate phenomenon. The evoTS package includes functions to fit the following multivariate trait models:
-
Multivariate unbiased random walks
-
Multivariate decelerated evolution
-
Multivariate accelerated evolution
-
Multivariate Ornstein-Uhlenbeck processes
We will first go through the multivariate unbiased random walk models without (unbiased random walk) and with (decelerated and accelerated evolution) changes in the rate of evolution.
Multivariate unbiased random walks with and without changes in the rate of evolution
Evolution as a multivariate unbiased random walk is modeled using an evolutionary rate matrix R (Felsenstein 1988; Revell and Harmon 2008). The diagonal elements in R represent the rate of evolution for the individual traits, while the off-diagonal elements represent the extent to which different traits co-evolve.
The multivariate variance-covariance matrix for the unbiased random walk model (V) is computed using the Kronecker product of the R matrix and a “distance matrix” C, describing the distance in time between the different samples/populations in the time series.
\[V = \sum_{i=1}^{m} R \otimes C\]Sampling error of the trait mean (calculated as the sample variance divided by the sample size) is – as for all models in evoTS – added to the diagonal of the V matrix. To ensure symmetric positive definiteness of the V matrix during log-likelihood optimization, R is parameterized by its Cholesky decomposition as the cross-product of upper triangular matrices. In cases where different parts of the evolutionary time series are described by $R_{m}$ matrices, V is computed as the sum of the different $R_{m}$ and $C_{m}$ matrices:
\[V = \sum_{i=1}^{m} R_{m} \otimes C_{m}\]The current implementation of the multivariate unbiased random walk model allows testing six variants of the model. All variants of the model can be fitted using different specifications of R and r arguments in the fit.multivariate.URW function.
There are two options for the structure of the R matrix. Setting R = "diag" means only the diagonal elements of the R matrix will be estimated while off-diagonal elements are set to $0$ (see panel a) below). This parameterization of the R matrix means the changes in the traits are assumed to be uncorrelated. Setting R = "symmetric" means all (both diagonal and off-diagonal) elements in the R matrix are estimated (see panel b) below). This parameterization estimates how changes in the traits are correlated.

The argument r in the fit.multivariate.URW function defines whether the rate of change is assumed constant (“fixed”), asymptotically decreasing (“decel”), or asymptotically increasing (“accel”) with time. Defining r as “fixed” means a regular multivariate unbiased random walk is fitted to the data. The “decel” and “accel” options fit multivariate versions of the decelerated and accelerated versions of the unbiased random walk, respectively. These latter two models deviate from the multivariate unbiased random walk in that the distance matrix C is transformed by an exponential decay or acceleration parameter, $r$, that is jointly estimated during the maximum log-likelihood search for the R matrix. A common $r$ parameter is assumed for all the traits.
To use the multivariate models, we first need multivariate data (i.e., at least two traits or variables).
The dataset on phenotypic evolution in Stephanodiscus yellowstonensis (Theriot et al. 2006) contains data on the number of ribs in addition to the size of the diameter we have analysed so far. Before combining the rib and diameter data into a multivariate dataset, we first do an approximate log-transformation of the data:
ln_ribs <- paleoTS::ln.paleoTS(ribs_S.yellowstonensis)
ln_diameter <- paleoTS::ln.paleoTS(diameter_S.yellowstonensis)
and convert the time vector to unit length:
ln_ribs$tt <- ln_ribs$tt/(max(ln_ribs$tt))
ln_diameter$tt <- ln_diameter$tt/(max(ln_diameter$tt))
We combine the two paleoTS objects into a multivariate evoTS object using the make.multivar.evoTS function to make a multivariate dataset ready to be analysed in evoTS:
diam_ln_ribs_ln <- make.multivar.evoTS(ln_diameter, ln_ribs)
We can also use the plotevoTS.multivariate function to have a look at the combined data set:
plotevoTS.multivariate(diam_ln_ribs_ln, y_min = 3.4, y_max = 4.8, x.label = "Relative time", pch = c(20,20))

Eye-balling the data seems to suggest that the traits change in a coordinated fashion.
We first fit a multivariate unbiased random walk model where the off-diagonal elements in the R matrix are zero, and the rate of evolution is assumed constant. This is equivalent to fitting two separate univariate unbiased random walk models to each of the two time series.
fit.multivariate.URW(diam_ln_ribs_ln, R = "diag", r = "fixed")
>
$converge
[1] "Model converged successfully"
$modelName
[1] "Multivariate model: Random walk (R matrix with zero off-diagonal elements)"
$logL
[1] 138.2735
$AICc
[1] -267.8573
$ancestral.values
[1] 3.728781 4.031994
$SE.anc
[1] NA
$R
[,1] [,2]
[1,] 0.171991 0.0000000
[2,] 0.000000 0.5559111
$SE.R
[1] NA
$method
[1] "Joint"
$K
[1] 4
$n
[1] 63
$iter
[1] NA
attr(,"class")
[1] "evoTSmvFit"
The returned parameters include the ancestral trait values for the two traits and the evolutionary rate matrix R. The diagonal in the R matrix contains the step size (rate of evolution) parameters. The second trait (ribs) has more than three times the rate of evolution as the first parameter (diameter). The off-diagonal elements are zero as this model is not estimating the covariance of the evolutionary changes in the two traits.
Next, we fit a model that allows the off-diagonal elements in the R matrix to be different from zero. We do this by setting R = "symmetric". We are still keeping the rate of change fixed through time.
fit.multivariate.URW(diam_ln_ribs_ln, R = "symmetric", r = "fixed")
>
$converge
[1] "Model converged successfully"
$modelName
[1] "Multivariate model: Random walk (R matrix with non-zero off-diagonal elements)"
$logL
[1] 183.0966
$AICc
[1] -355.1405
$ancestral.values
[1] 3.733908 4.037094
$SE.anc
[1] NA
$R
[,1] [,2]
[1,] 0.2897505 0.4042712
[2,] 0.4042712 0.5780543
$SE.R
[1] NA
$method
[1] "Joint"
$K
[1] 5
$n
[1] 63
$iter
[1] NA
attr(,"class")
[1] "evoTSmvFit"
A multivariate random walk with correlated changes has a much better fit compared to the model assuming uncorrelated changes in the traits according to AICc Akaike 1974. This indicates that the traits are not evolving independently of each other. The estimated R matrix indicates that the first trait has about half the rate of evolution as the second trait and that there is substantial covariance in the evolutionary changes of the two traits. How the two traits correlate in their changes can be computed by standardising the covariance with the product of the standard deviations on the diagonal (this can also be done using the function cov2cor in the stats package):
0.4042712/(sqrt(0.2897505)*sqrt(0.5780543))
>
[1] 0.9878168
or alternatively:
model1 <- fit.multivariate.URW(diam_ln_ribs_ln, R = "symmetric", r = "fixed")
stats::cov2cor(model1$R)
>
[,1] [,2]
[1,] 1.0000000 0.9878167
[2,] 0.9878167 1.0000000
A correlation of 0.98 basically means the two traits evolve as a single trait, since at least part of the deviation from a correlation of 1 is due to measurement error.
Note that the R matrix is not describing the underlying genetic or phenotypic (co)variances of the traits. The R matrix is therefore not the same as a P (or G) matrix in quantitative genetics. However, the R matrix is tightly connected to these matrices. For example, if the traits evolve only due to drift, the R matrix is expected to be proportional to the additive genetic variance–covariance matrix (G) (Lande 1979; Felsenstein 1988). Estimating R can therefore aid in evolutionary interpretations of the fossil record anchored in evolutionary quantitative genetics.
Standard errors of the elements in the R matrix can be approximated by the square root of the diagonal elements of the inverse of the negative of the Hessian matrix. These standard errors are automatically estimated and reported if the argument hess = TRUE is defined.
Parameterising multivariate models is demanding in terms of computational time (Felsenstein 1973; Hadfield and Nakagawa 2010; Freckleton 2012). Be aware that fitting the multivariate models to several traits with many samples (populations) will take a much longer time than fitting univariate models to each trait separately. One way to somewhat follow the progress of the model fit is to set trace = TRUE. This allows the user to follow the progress of the optimisation routine to minimise the log-likelihood function.
The log-likelihood surface of multivariate models can contain several local peaks. It is therefore recommended to re-run the model from different starting points (i.e., different initial parameter values). The number of iterations can be defined by the iterations argument (e.g., iterations = 10). Initial values for the search algorithm are drawn from a normal distribution with a default standard deviation of 1. The user can set this standard deviation by the iter.sd argument (e.g., iter.sd = 0.5).
We can check if we find evidence for a change in the R matrix along the time series. This involves estimating a separate R matrix for two non-overlapping parts of the time series. This is done using the function fit.multivariate.URW.shift. We can define the shift point using the argument shift.point (e.g., shift.point = 20) or we can investigate all possible shift points in the time series by not defining a shift point (the default option). The length of the smallest number of samples (populations) in each of the two segments is controlled by the minb argument (the default is 10).
fit.multivariate.URW.shift(diam_ln_ribs_ln, hess = TRUE)
>
Total # hypotheses: 44
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 $converge
[1] "Model converged successfully"
$modelName
[1] "Multivariate model: Random walk with two R matrices (with non-zero off-diagonal elements)"
$logL
[1] 191.4232
$AICc
[1] -361.4503
$ancestral.values
3.743612 4.047729
$SE.anc
[1] 0.01874859 0.02505847
$R
$R$R.1
[,1] [,2]
[1,] 0.4316810 0.7019228
[2,] 0.7019228 1.1413418
$R$R.2
[,1] [,2]
[1,] 0.2174425 0.2711459
[2,] 0.2711459 0.3453505
$SE.R
$SE.R$SE.R.1
[,1] [,2]
[1,] 0.01760289 0.02742754
[2,] 0.02742754 0.04450097
$SE.R$SE.R.2
[,1] [,2]
[1,] 0.003626942 0.004427382
[2,] 0.004427382 0.006380644
$shift.point
[1] 18
$method
[1] "Joint"
$K
[1] 9
$n
[1] 63
$iter
[1] NA
attr(,"class")
[1] "evoTSmvFit"
Two R matrices are returned (R.1 and R.2), along with their standard errors (since we used hess = TRUE). The estimated shift point is 18 (shift.point in the output). The rate of evolution is larger in the second trait compared to the first trait (the diagonal elements in R.1) while the difference in the rate of evolution is much smaller after the shift point (the diagonal elements in R.2). The evolutionary correlation is 1 and 0.99 before and after the shift point. The number of parameters ($K$) for this model is 9 compared to 5 for the model where we estimated a single R matrix for the multivariate dataset. The model with two R matrices has a lower (better) AICc score compared to the model with a single R matrix. This difference in AICc scores is likely to be a result of the differences in rates of evolution in R.1 and R.2, since the evolutionary correlation is estimated to be very similar in both R.1 and R.2.
We now check if the multivariate accelerated and decelerated models have a better fit than the multivariate unbiased random walk models:
multi_accel <- fit.multivariate.URW(diam_ln_ribs_ln, R = "symmetric", r = "accel")
multi_decel <- fit.multivariate.URW(diam_ln_ribs_ln, R = "symmetric", r = "decel")
multi_accel$AICc;multi_decel$AICc
>
[1] -352.6852
[1] -357.6313
The multivariate decelerated evolution model has a better fit to the data compared to the multivariate unbiased random walk model with a single R matrix, but is out-competed by the model estimating two R matrices.
Now that we have looked at the multivariate unbiased random walk models, let’s learn more about the multivariate Ornstein-Uhlenbeck models.