model.comparison() for PGLS and OLS (AIC)

13 views
Skip to first unread message

Ricardo Ely

unread,
Nov 7, 2025, 7:53:29 AMNov 7
to geomorph R package
Hello, 

I'm investigating the impact of phylogenetic signal for downstream morphological disparity analyses. First, I define two PGLS models using procD.lm with covariance matrices specified under regular BM conditions and the other with *lambda rescaling applied. I use these outputs in the RRPP function model.comparison to get AIC values for model fit. My question is whether I should include an OLS model in the model.comparison function to compare with the two PGLS models? My intuition says this is alright to do so, as perhaps phylogenetic signal (in the residual landmarks) does not impact our downstream results with morphological disparity. In other words, if the best fitting linear model is OLS, then we can conclude phylogenetic signal would have a negligible effect on our analyses of morphological disparity. 

Best, 

Ricardo 

P.S. *I found the best fitting lambda using mvMORPH's mvgls() function applied on all shape data, then extracted the phylogenetic covariance matrix based on the lambda rescaled phylogeny.   

Mike Collyer

unread,
Nov 7, 2025, 8:50:03 AMNov 7
to geomorph R package
Dear Ricardo,

Using an OLS model is probably a good idea but you should make sure your covariance matrices are comparable, meaning their determinants are calculated based on similar scaling.  For example, an OLS model is a GLS model using a covariance matrix that is an identity matrix.  The identity matrix could be weighted by the tree depth (common value on the diagonal of the phylogenetic covariance matrix).  You can do this like so (with N taxa):

d <- PhyCov[1]
wI <- d * diag(N)

Then use wI as a covariance matrix for a GLS fit, which will inflate the determinant of the OLS residual covariance matrix fairly to account for tree depth (height).  Alternatively, you could make your phylogenetic covariance matrix unit depth.  This can be done “by hand” but RRPP has a function, scaleCov, which can rescale phylogenetic covariance matrices by lambda, but also does more.  Here is an example

uPhyCov <- scaleCov(PhyCov, scale. = 1/d, scale.diagonal = TRUE)

This covariance matrix could be used in a GLS fit and could be compared to an OLS fit.

Either approach makes sure covariance matrices have the same diagonal, which means an OLS model is the same as GLS with a star phylogeny, given the depth of tree used.

Note that

scaleCov(PhyCov, scale. = lambda, scale.diagonal = FALSE)

should produce the same or similar covariance matrix as mvgls, provided the unscaled phylogenetic covariance matrices are the same.  The difference is that scaling a tree by lambda does not change its depth.  Scaling the covariance matrix by 1/d and including the diagonal makes the tree unit depth.  One could scale the covariance matrix by lambda/d and include the diagonal, which would simultaneously adjust the branch lengths and make the tree unit depth.

hope that helps!

Mike

--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/geomorph-r-package/9e317979-7472-4d1e-959d-5111de3abab1n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages