require(pavo)
require(dplyr)
require(phytools)
require(geiger)
require(phylolm)
require(MuMIn)
require(ggplot2)
require(viridis)
load('output/processedata.rdata')
plot(colspace(visdat), col=spec2rgb(alldatp, alpha=0.2))
## Warning: Quantum catch are not relative, and have been transformed
plot(xyzdatr, col=spec2rgb(alldatp, alpha=0.2), theta=275, arrow.p=3.5)
Phylogeny showing the scaled Dominance index
The best model included body mass, chromaticity, and their interaction. Marginal effects of chromaticity were not significant, though. The best model without chromaticity or their interaction had a \(\Delta\)AIC of 6.91.
fullmodel <- phylolm(bradley.terry.score.x~log.mass + chrom + span + achromean + achrospan +
log.mass:chrom +
log.mass:span +
log.mass:achromean +
log.mass:achrospan, data=dat, phy=tr, model='OUrandomRoot')
#aictable <- dredge(fullmodel)
aictable <- dredge(fullmodel,
subset=!(chrom && achromean) && !(chrom && achrospan) &&
!(span && achromean) && !(span && achrospan))
## Fixed term is "(Intercept)"
subset(aictable, delta < 10)
## Global model call: phylolm(formula = bradley.terry.score.x ~ log.mass + chrom +
## span + achromean + achrospan + log.mass:chrom + log.mass:span +
## log.mass:achromean + log.mass:achrospan, data = dat, phy = tr,
## model = "OUrandomRoot")
## ---
## Model selection table
## (Int) achrm achrs chr log.mss spn chr:log.mss
## 141 -0.09407 -0.04520 0.6091 -0.2456
## 157 -0.09134 -0.07756 0.6081 0.048910 -0.2443
## 413 -0.08902 -0.08138 0.6171 0.070580 -0.3096
## 9 -0.03734 0.6630
## 281 -0.06919 0.6268 -0.038420
## 13 -0.04220 -0.05190 0.6539
## 11 -0.04081 -0.03193 0.6633
## 10 -0.03703 -0.008842 0.6630
## 25 -0.03825 0.6627 -0.006100
## 285 -0.06713 -0.06654 0.6171 0.006153
## log.mss:spn df logLik AICc delta weight
## 141 6 -139.839 292.4 0.00 0.605
## 157 7 -139.703 294.3 1.97 0.226
## 413 0.09857 8 -139.376 296.0 3.59 0.101
## 9 4 -145.479 299.3 6.91 0.019
## 281 -0.16610 6 -143.549 299.8 7.42 0.015
## 13 5 -145.265 301.0 8.65 0.008
## 11 5 -145.375 301.2 8.87 0.007
## 10 5 -145.470 301.4 9.06 0.007
## 25 5 -145.476 301.4 9.07 0.006
## 285 -0.16270 7 -143.327 301.6 9.22 0.006
## Models ranked by AICc(x)
summary(model.avg(aictable))
##
## Call:
## model.avg(object = aictable)
##
## Component model call:
## phylolm(formula = bradley.terry.score.x ~ <24 unique rhs>, data =
## dat, phy = tr, model = OUrandomRoot)
##
## Component models:
## df logLik AICc delta weight
## 348 6 -139.84 292.37 0.00 0.60
## 3458 7 -139.70 294.34 1.97 0.22
## 34589 8 -139.38 295.96 3.59 0.10
## 4 4 -145.48 299.28 6.91 0.02
## 459 6 -143.55 299.79 7.42 0.01
## 34 5 -145.26 301.02 8.65 0.01
## 24 5 -145.37 301.24 8.87 0.01
## 14 5 -145.47 301.43 9.06 0.01
## 45 5 -145.48 301.44 9.07 0.01
## 3459 7 -143.33 301.59 9.22 0.01
## 247 6 -144.98 302.66 10.29 0.00
## 345 6 -145.17 303.04 10.66 0.00
## 124 6 -145.32 303.33 10.96 0.00
## 146 6 -145.46 303.61 11.24 0.00
## 1247 7 -144.96 304.85 12.48 0.00
## 1246 7 -145.32 305.57 13.20 0.00
## 12467 8 -144.90 307.01 14.64 0.00
## 3 4 -170.12 348.57 56.20 0.00
## 5 4 -171.06 350.44 58.07 0.00
## 35 5 -169.99 350.48 58.11 0.00
## (Null) 3 -173.31 352.82 60.44 0.00
## 2 4 -172.71 353.74 61.37 0.00
## 12 5 -171.85 354.20 61.82 0.00
## 1 4 -173.08 354.49 62.12 0.00
##
## Term codes:
## achromean achrospan chrom
## 1 2 3
## log.mass span achromean:log.mass
## 4 5 6
## achrospan:log.mass chrom:log.mass log.mass:span
## 7 8 9
##
## Model-averaged coefficients:
## (full average)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -8.914e-02 7.508e-02 1.187 0.2351
## chrom -5.340e-02 8.141e-02 0.656 0.5119
## log.mass 6.131e-01 7.377e-02 8.310 <2e-16 ***
## chrom:log.mass -2.318e-01 1.017e-01 2.280 0.0226 *
## span 1.748e-02 6.144e-02 0.284 0.7761
## log.mass:span 6.378e-03 5.555e-02 0.115 0.9086
## achrospan -5.414e-04 9.929e-03 0.055 0.9565
## achromean -1.746e-04 8.333e-03 0.021 0.9833
## achrospan:log.mass -3.322e-04 7.138e-03 0.047 0.9629
## achromean:log.mass -3.471e-05 4.153e-03 0.008 0.9933
##
## (conditional average)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.08914 0.07508 1.187 0.23511
## chrom -0.05704 0.08290 0.688 0.49136
## log.mass 0.61306 0.07377 8.310 < 2e-16 ***
## chrom:log.mass -0.25216 0.07822 3.224 0.00127 **
## span 0.04962 0.09551 0.520 0.60336
## log.mass:span 0.05326 0.15255 0.349 0.72696
## achrospan -0.03510 0.07196 0.488 0.62569
## achromean -0.01297 0.07066 0.184 0.85432
## achrospan:log.mass -0.06585 0.07605 0.866 0.38660
## achromean:log.mass -0.01030 0.07077 0.145 0.88434
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Relative variable importance:
## log.mass chrom chrom:log.mass span log.mass:span
## Importance: 1 0.94 0.92 0.35 0.12
## N containing models: 17 8 3 8 3
## achrospan achromean achrospan:log.mass
## Importance: 0.02 0.01 0.01
## N containing models: 8 8 3
## achromean:log.mass
## Importance: <0.01
## N containing models: 3
What the best model looks like
##
## Call:
## phylolm(formula = bradley.terry.score.x ~ log.mass * chrom, data = dat,
## phy = tr, model = "OUrandomRoot")
##
## AIC logLik
## 291.7 -139.8
##
## Raw residuals:
## Min 1Q Median 3Q Max
## -1.80773 -0.31026 0.08803 0.29754 2.46674
##
## Mean tip height: 1
## Parameter estimate(s) using ML:
## alpha: 27.97037
## sigma2: 30.28614
##
## Coefficients:
## Estimate StdErr t.value p.value
## (Intercept) -0.094073 0.073683 -1.2767 0.2040861
## log.mass 0.609131 0.072429 8.4100 8.239e-14 ***
## chrom -0.045197 0.070943 -0.6371 0.5252356
## log.mass:chrom -0.245573 0.071206 -3.4488 0.0007699 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Note: p-values are conditional on alpha=27.97037.
So for large body sizes, chromaticity is negatively associated with dominance, whereas for small birds this relationship is inverted and chromaticity is positively associated with dominance. Marginal effect of chromaticity is close to zero on average body sizes, though.