Wow, 8 years passes so fast! Yes, functions have been updated and yes, you can use pairwise with a PGLS fit. There is nothing wrong with doing this. But to answer the other question, no, I do not think theoretical advances have been made in the area of pairwise comparisons for GLS models. The reason why this is challenging, but isn’t for OLS models, is that although it is easy to make predictions with a GLS model (estimate GLS means), and compare those means, it is not possible to do this with a good sampling distribution with respect to appropriate standard error of the estimates.
Hope fully I can explain this. The residual covariance for any linear model can be calculated as V = R^T C^-1 R, where ^t means matrix transpose, ^-1 means matrix inverse, R is the matrix of residuals, and C is the matrix of phylogenetic covariances. R is found from GLS estimation. C is a N x N matrix for N species. But if we let C = I, an identity matrix (independence), R becomes OLS residuals instead of GLS residuals. Algebra still works the same. We can estimate the standard error of the model fit from V. However, if we make estimates for g groups rather than N species, there is no way to include C in the calculation, because g != N. This is of little concern for OLS estimation, because a g x g identity matrix can be used instead of an N x N identity matrix.
With pairwise comparisons, the RRPP distribution of pairwise mean differences is consistent with the distribution of F statistics in ANOVA. I can show this below. Notice the bolded P-values.
> library(phytools)
> library(RRPP)
> tree <- pbtree(n= 20)
> y <- fastBM(tree)
> g <- factor(rep(1:2, each = 10))
> names(g) <- names(y)
> y[1:10] <- y[1:10] + 2
> fit.ols <- lm.rrpp(y ~ g)
> fit.gls <- lm.rrpp(y ~ g, Cov = vcv(tree))
>
> pw.ols <- pairwise(fit.ols, groups = g)
> pw.gls <- pairwise(fit.gls, groups = g)
>
> anova(fit.ols)
Analysis of Variance, using Residual Randomization
Permutation procedure: Randomization of null model residuals
Number of permutations: 1000
Estimation method: Ordinary Least Squares
Sums of Squares and Cross-products: Type I
Effect sizes (Z) based on F distributions
Df SS MS Rsq F Z Pr(>F)
g 1 9.3241 9.3241 0.31269 8.1891 2.0588 0.016 *
Residuals 18 20.4948 1.1386 0.68731
Total 19 29.8190
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Call: lm.rrpp(f1 = y ~ g)
> summary(pw.ols)
Pairwise comparisons
Groups: 1 2
RRPP: 1000 permutations
LS means:
Vectors hidden (use show.vectors = TRUE to view)
Pairwise distances between means, plus statistics
d UCL (95%) Z Pr > d
1:2 1.365587 1.148485 1.957779 0.016
The P-values are exactly the same when performing pairwise comparisons between the only two groups as with performing ANOVA. But if we do the same thing with the PGLS model fit:
> anova(fit.gls)
Analysis of Variance, using Residual Randomization
Permutation procedure: Randomization of null model residuals
Number of permutations: 1000
Estimation method: Generalized Least-Squares (via OLS projection)
Sums of Squares and Cross-products: Type I
Effect sizes (Z) based on F distributions
Df SS MS Rsq F Z Pr(>F)
g 1 5.104 5.1040 0.19 4.2223 1.6193 0.045 *
Residuals 18 21.759 1.2088 0.81
Total 19 26.863
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Call: lm.rrpp(f1 = y ~ g, Cov = vcv(tree))
> summary(pw.gls)
Pairwise comparisons
Groups: 1 2
RRPP: 1000 permutations
LS means:
Vectors hidden (use show.vectors = TRUE to view)
Pairwise distances between means, plus statistics
d UCL (95%) Z Pr > d
1:2 1.57239 1.964684 1.202466 0.117
Why did this happen? There is no apparent way to transform the distances by the phylogenetic covariance matrix, C, for the two estimates made. The distance between PGLS estimates is not significant even though the between-group variance is. In ANOVA, variances are appropriate because the residual covariance matrix is the GLS covariance matrix. In pairwise comparisons, not as much.
I believe the solution is probably to use instead of d, the statistic d/se, where se is the estimated standard error in every random permutation. This would accomplish the same thing, in principle, as a parametric t-test. Chances are the standard error would tend to be higher in random permutations in the above example, so the observed d would be relatively larger, if divided by se.
This is the research that still has to be done: find a procedure that produces consistent distributions, despite the inability to properly transform statistics. If the example above were real data and I found conflicting results, I would interpret the results as the effect of group was slightly significant but evidence was lacking to suggest their means are distinct. In other words, i would not have sufficient statistical power to detect a meaningful difference between means.
Hope that helps!
Mike