Contents
Load 3D brain coordinates for the wholebrain and each region: telencephalon (tel), diencephalon (dien), mesencephalon (mes), cerebellum (cere), and medulla oblongata (medob). Load trait data. Load phylogenetic tree.
# Brain coordinate data
load(here::here('data/whole_brain_coords_S1.Rda')) # wholebrain
load(here::here('data/tel_coords_S1.Rda')) # tel
load(here::here('data/dien_coords_S1.Rda')) # dien
load(here::here('data/mes_coords_S1.Rda')) # mes
load(here::here('data/cere_coords_S1.Rda')) # cere
load(here::here('data/medob_coords_S1.Rda')) # medob
# Trait data
load(here::here('data/lizard_trait_data.Rda'))
# Phylogenetic tree data
load(here::here('data/lizard_tree.Rda'))
Part 1. Perform a generalize procrustes analysis (GPA) with gpagen on the coordinate data. GPA aligns all the species coordinates in the most optimal way (e.g., removing scale, orientation, and position) so that we can better compare the shapes of each species to each other.
library(geomorph)
wb.gpa <- gpagen(wholebrain, ProcD = T, verbose = T, print.progress = F)
Part 2. Create a geomorph data frame that contains the Procrustes coordinates and the trait data. This will be used in subsequent analyses.
wb.gdf <- geomorph.data.frame(wb.gpa, trait)
Part 3. Run a Phylogenetic ANOVA/regression (PGLS) with procD.pgls to test for correlations between ecological traits and whole brain size and shape.
Whole Brain Shape:
note: we included Csize as a covariate since shape often covaries with size. Refer to supplementary information for how much shape variation is explained by size.
pgls_wb.shape <- procD.pgls(coords ~ Csize + abslatitude + precip_seasonality + temp_seasonality + microhabitat + activity_time + foraging_mode, phy = lzrd_tree, SS.type = "II", data = wb.gdf, print.progress = F)
Whole Brain Size:
pgls_wb.size <- procD.pgls(Csize ~ abslatitude + precip_seasonality + temp_seasonality + microhabitat + activity_time + foraging_mode, phy = lzrd_tree, SS.type = "II", data = wb.gdf, print.progress = F)
| Whole Brain Shape | |||||||
|---|---|---|---|---|---|---|---|
| Source | df1 | SS2 | MS3 | Rsq | F | Z | p-value4 |
| Csize | 1 | 0.0002 | 0.0002 | 0.022 | 0.79 | −0.29 | 0.606 |
| abslatitude | 1 | 0.0004 | 0.0004 | 0.040 | 1.45 | 1.00 | 0.164 |
| precip_seasonality | 1 | 0.0004 | 0.0004 | 0.038 | 1.40 | 0.90 | 0.187 |
| temp_seasonality | 1 | 0.0004 | 0.0004 | 0.043 | 1.58 | 1.20 | 0.121 |
| microhabitat | 2 | 0.0004 | 0.0002 | 0.037 | 0.68 | −0.91 | 0.810 |
| activity_time | 2 | 0.0006 | 0.0003 | 0.060 | 1.10 | 0.42 | 0.341 |
| foraging_mode | 2 | 0.0011 | 0.0005 | 0.105 | 1.92 | 1.82 | 0.035 |
| Residuals | 18 | 0.0051 | 0.0003 | 0.491 | |||
| Total | 28 | 0.0104 | |||||
|
1
df, degree of freedom.
2
SS, sum of squares.
3
MS, mean squares.
4
Significant values (p-value < 0.05) from permutation tests (1,000 permutation rounds) are bolded.
|
|||||||
| Whole Brain Size | |||||||
|---|---|---|---|---|---|---|---|
| Source | df1 | SS2 | MS3 | Rsq | F | Z | p-value4 |
| abslatitude | 1 | 1,499,533 | 1,499,533 | 0.067 | 8.14 | 2.27 | 0.010 |
| precip_seasonality | 1 | 894,879 | 894,879 | 0.040 | 4.86 | 1.73 | 0.037 |
| temp_seasonality | 1 | 634,775 | 634,775 | 0.028 | 3.45 | 1.35 | 0.092 |
| microhabitat | 2 | 3,181,370 | 1,590,685 | 0.141 | 8.63 | 2.78 | 0.003 |
| activity_time | 2 | 3,196,026 | 1,598,013 | 0.142 | 8.67 | 2.73 | 0.001 |
| foraging_mode | 2 | 4,459,516 | 2,229,758 | 0.198 | 12.10 | 3.08 | 0.003 |
| Residuals | 19 | 3,500,391 | 184,231 | 0.156 | |||
| Total | 28 | 22,507,049 | |||||
|
1
df, degree of freedom.
2
SS, sum of squares.
3
MS, mean squares.
4
Significant values (p-value < 0.05) from permutation tests (1,000 permutation rounds) are bolded.
|
|||||||
Effect size of each ecological variable on Csize. In other words, the slope.
| x | |
|---|---|
| (Intercept) | 25670.231936 |
| abslatitude | -282.523262 |
| precip_seasonality | -93.563890 |
| temp_seasonality | 0.931508 |
| microhabitatScansorial | 18999.847959 |
| microhabitatTerrestrial | 11975.208592 |
| activity_timeDiurnal | -11392.279470 |
| activity_timeNocturnal | 947.635953 |
| foraging_modemixed | -9009.089163 |
| foraging_modesit_and_wait | 3316.507502 |
Fig 1. Foraging Mode
Fig S1. Activity Time
Fig S2. Microhabitat
Part 4. To visualize shape variation, we performed a principle components analysis with phylogeny considered (phyloPCA) with gm.prcomp on the Procrustes shape coordinates and plotted them.
wb.pca <- gm.prcomp(wb.gpa$coords, phy = lzrd_tree, GLS = TRUE)
kable(summary(wb.pca))
##
## Ordination type: Principal Component Analysis
## Centering by GLS mean
## Oblique projection of GLS-centered residuals
## Number of observations: 29
## Number of vectors 28
##
## Importance of Components:
## Comp1 Comp2 Comp3 Comp4
## Eigenvalues 0.0001316915 7.168048e-05 3.066885e-05 2.912548e-05
## Proportion of Variance 0.3544202540 1.929130e-01 8.253879e-02 7.838514e-02
## Cumulative Proportion 0.3544202540 5.473333e-01 6.298721e-01 7.082572e-01
## Comp5 Comp6 Comp7 Comp8
## Eigenvalues 1.792596e-05 1.396093e-05 1.180115e-05 9.329498e-06
## Proportion of Variance 4.824397e-02 3.757293e-02 3.176033e-02 2.510839e-02
## Cumulative Proportion 7.565012e-01 7.940741e-01 8.258344e-01 8.509428e-01
## Comp9 Comp10 Comp11 Comp12
## Eigenvalues 8.160733e-06 7.369369e-06 5.364527e-06 5.261816e-06
## Proportion of Variance 2.196290e-02 1.983311e-02 1.443750e-02 1.416108e-02
## Cumulative Proportion 8.729057e-01 8.927388e-01 9.071763e-01 9.213374e-01
## Comp13 Comp14 Comp15 Comp16
## Eigenvalues 4.636602e-06 3.913735e-06 3.312183e-06 2.516895e-06
## Proportion of Variance 1.247845e-02 1.053300e-02 8.914047e-03 6.773696e-03
## Cumulative Proportion 9.338159e-01 9.443489e-01 9.532629e-01 9.600366e-01
## Comp17 Comp18 Comp19 Comp20
## Eigenvalues 2.494481e-06 2.244242e-06 2.144861e-06 1.807060e-06
## Proportion of Variance 6.713373e-03 6.039909e-03 5.772445e-03 4.863325e-03
## Cumulative Proportion 9.667500e-01 9.727899e-01 9.785623e-01 9.834257e-01
## Comp21 Comp22 Comp23 Comp24
## Eigenvalues 1.358770e-06 1.084812e-06 1.063795e-06 8.240360e-07
## Proportion of Variance 3.656846e-03 2.919546e-03 2.862983e-03 2.217721e-03
## Cumulative Proportion 9.870825e-01 9.900020e-01 9.928650e-01 9.950827e-01
## Comp25 Comp26 Comp27 Comp28
## Eigenvalues 5.980015e-07 5.618345e-07 3.909081e-07 2.763531e-07
## Proportion of Variance 1.609396e-03 1.512060e-03 1.052048e-03 7.437467e-04
## Cumulative Proportion 9.966921e-01 9.982042e-01 9.992563e-01 1.000000e+00
##
##
## Dispersion (variance) of points, after projection:
## Comp1 Comp2 Comp3
## Tips Dispersion 0.009681169 0.007147906 1.424633e-03
## Proportion Tips Dispersion 0.276397409 0.204072738 4.067327e-02
## Cumulative Tips Dispersion 0.276397409 0.480470146 5.211434e-01
## Ancestors Dispersion 0.001433389 0.001439172 5.123635e-05
## Proportion Ancestors Dispersion 0.188462865 0.189223247 6.736587e-03
## Cumulative Ancestors Dispersion 0.188462865 0.377686112 3.844227e-01
## Comp4 Comp5 Comp6
## Tips Dispersion 0.004498675 0.0014740868 0.0014429243
## Proportion Tips Dispersion 0.128437181 0.0420851820 0.0411954938
## Cumulative Tips Dispersion 0.649580596 0.6916657778 0.7328612717
## Ancestors Dispersion 0.001551935 0.0002614725 0.0003820672
## Proportion Ancestors Dispersion 0.204049282 0.0343785602 0.0502344227
## Cumulative Ancestors Dispersion 0.588471980 0.6228505406 0.6730849633
## Comp7 Comp8 Comp9
## Tips Dispersion 0.0011558875 0.0009710775 0.0011683956
## Proportion Tips Dispersion 0.0330005911 0.0277242672 0.0333576989
## Cumulative Tips Dispersion 0.7658618628 0.7935861300 0.8269438289
## Ancestors Dispersion 0.0002525653 0.0002915638 0.0002873258
## Proportion Ancestors Dispersion 0.0332074365 0.0383349775 0.0377777747
## Cumulative Ancestors Dispersion 0.7062923997 0.7446273773 0.7824051520
## Comp10 Comp11 Comp12
## Tips Dispersion 0.0009704764 0.0005768218 5.462224e-04
## Proportion Tips Dispersion 0.0277071033 0.0164682644 1.559465e-02
## Cumulative Tips Dispersion 0.8546509322 0.8711191967 8.867138e-01
## Ancestors Dispersion 0.0003394359 0.0001042129 6.843176e-05
## Proportion Ancestors Dispersion 0.0446292407 0.0137019690 8.997449e-03
## Cumulative Ancestors Dispersion 0.8270343927 0.8407363617 8.497338e-01
## Comp13 Comp14 Comp15
## Tips Dispersion 0.0003536412 3.276284e-04 0.0004409799
## Proportion Tips Dispersion 0.0100964563 9.353793e-03 0.0125899767
## Cumulative Tips Dispersion 0.8968103057 9.061641e-01 0.9187540754
## Ancestors Dispersion 0.0000241316 3.234363e-05 0.0001142089
## Proportion Ancestors Dispersion 0.0031728374 4.252560e-03 0.0150162489
## Cumulative Ancestors Dispersion 0.8529066481 8.571592e-01 0.8721754566
## Comp16 Comp17 Comp18
## Tips Dispersion 0.0005190988 0.0002320877 2.611313e-04
## Proportion Tips Dispersion 0.0148202714 0.0066261044 7.455300e-03
## Cumulative Tips Dispersion 0.9335743468 0.9402004512 9.476558e-01
## Ancestors Dispersion 0.0002345241 0.0000232721 7.300627e-05
## Proportion Ancestors Dispersion 0.0308353727 0.0030598292 9.598908e-03
## Cumulative Ancestors Dispersion 0.9030108293 0.9060706584 9.156696e-01
## Comp19 Comp20 Comp21
## Tips Dispersion 1.932345e-04 3.043619e-04 2.052370e-04
## Proportion Tips Dispersion 5.516846e-03 8.689534e-03 5.859516e-03
## Cumulative Tips Dispersion 9.531726e-01 9.618621e-01 9.677216e-01
## Ancestors Dispersion 1.456516e-05 9.286695e-05 6.261602e-05
## Proportion Ancestors Dispersion 1.915035e-03 1.221020e-02 8.232792e-03
## Cumulative Ancestors Dispersion 9.175846e-01 9.297948e-01 9.380276e-01
## Comp22 Comp23 Comp24
## Tips Dispersion 0.0003165744 0.0001298523 1.528279e-04
## Proportion Tips Dispersion 0.0090382001 0.0037072839 4.363237e-03
## Cumulative Tips Dispersion 0.9767598484 0.9804671324 9.848304e-01
## Ancestors Dispersion 0.0001460516 0.0000252477 4.318368e-05
## Proportion Ancestors Dispersion 0.0192029540 0.0033195830 5.677816e-03
## Cumulative Ancestors Dispersion 0.9572305495 0.9605501325 9.662279e-01
## Comp25 Comp26 Comp27
## Tips Dispersion 1.169243e-04 1.042967e-04 1.120526e-04
## Proportion Tips Dispersion 3.338190e-03 2.977670e-03 3.199102e-03
## Cumulative Tips Dispersion 9.881686e-01 9.911462e-01 9.943453e-01
## Ancestors Dispersion 3.730216e-05 2.708299e-05 4.972226e-05
## Proportion Ancestors Dispersion 4.904510e-03 3.560887e-03 6.537512e-03
## Cumulative Ancestors Dispersion 9.711325e-01 9.746933e-01 9.812309e-01
## Comp28
## Tips Dispersion 0.0001980619
## Proportion Tips Dispersion 0.0056546686
## Cumulative Tips Dispersion 1.0000000000
## Ancestors Dispersion 0.0001427522
## Proportion Ancestors Dispersion 0.0187691414
## Cumulative Ancestors Dispersion 1.0000000000
|
|
We are interested in the whole brain. We are also interested in the telencephalon and diencephalon becasue they are associated with olfaction and vision, respectively. This will be important when we test for association between these regions directly and the foraging modes associated with those sensory modalities. GPA on coordinates for each brain region
library(geomorph)
c.gpa <- gpagen(cere, ProcD = T, verbose = T)
d.gpa <- gpagen(dien, ProcD = T, verbose = T)
md.gpa <- gpagen(medob, ProcD = T, verbose = T)
ms.gpa <- gpagen(mes, ProcD = T, verbose = T)
t.gpa <- gpagen(tel, ProcD = T, verbose = T)
Create geomorph dataframe for each brain region
library(geomorph)
c.gdf <- geomorph.data.frame(c.gpa, trait)
d.gdf <- geomorph.data.frame(d.gpa, trait)
md.gdf <- geomorph.data.frame(md.gpa, trait)
ms.gdf <- geomorph.data.frame(ms.gpa, trait)
t.gdf <- geomorph.data.frame(t.gpa, trait)
Compute Csize ratio for each brain region to the whole brain (they don’t all add up to one…probably because the regions share some coordinates)
c <- c.gpa$Csize/wb.gpa$Csize
d <- d.gpa$Csize/wb.gpa$Csize
md <- md.gpa$Csize/wb.gpa$Csize
ms <- ms.gpa$Csize/wb.gpa$Csize
t <- t.gpa$Csize/wb.gpa$Csize
Create a data frame containing all the rgion-to-whole-brain Csize ratios and the raw Csize values for each region and the trait values
prop <- cbind(c, d, md, ms, t, wb.gpa$Csize, c.gpa$Csize, d.gpa$Csize, md.gpa$Csize, ms.gpa$Csize, t.gpa$Csize, trait)
PGLS of regional brain shape and foraging mode RESULTS: No regional effect of foraging mode on shape
pgls_cshape <- procD.pgls(coords ~ Csize + foraging_mode, phy = lzrd_tree, data=c.gdf, iter=999, print.progress = FALSE)
pgls_dshape <- procD.pgls(coords ~ Csize + foraging_mode, phy = lzrd_tree, data=d.gdf, iter=999, print.progress = FALSE)
pgls_mdshape <- procD.pgls(coords ~ Csize + foraging_mode, phy = lzrd_tree, data=md.gdf, iter=999, print.progress = FALSE)
pgls_msshape <- procD.pgls(coords ~ Csize + foraging_mode, phy = lzrd_tree, data=ms.gdf, iter=999, print.progress = FALSE)
pgls_tshape <- procD.pgls(coords ~ Csize + foraging_mode, phy = lzrd_tree, data=t.gdf, iter=999, print.progress = FALSE)
| Regional Brain Shape | |||||||
|---|---|---|---|---|---|---|---|
| Source | df1 | SS2 | MS3 | Rsq | F | Z | p-value4 |
| Telencephalon | |||||||
| Csize | 1 | 0.0035 | 0.0035 | 0.282 | 10.85 | 3.40 | 0.001 |
| foraging_mode | 2 | 0.0009 | 0.0004 | 0.070 | 1.34 | 0.90 | 0.188 |
| Residuals | 25 | 0.0081 | 0.0003 | 0.649 | |||
| Total | 28 | 0.0125 | |||||
| Mesencephalon | |||||||
| Csize | 1 | 0.0005 | 0.0005 | 0.038 | 1.07 | 0.42 | 0.336 |
| foraging_mode | 2 | 0.0009 | 0.0005 | 0.075 | 1.06 | 0.39 | 0.353 |
| Residuals | 25 | 0.0112 | 0.0004 | 0.887 | |||
| Total | 28 | 0.0126 | |||||
| Medulla Oblongata | |||||||
| Csize | 1 | 0.0006 | 0.0006 | 0.101 | 3.01 | 2.22 | 0.015 |
| foraging_mode | 2 | 0.0004 | 0.0002 | 0.062 | 0.93 | 0.02 | 0.486 |
| Residuals | 25 | 0.0049 | 0.0002 | 0.837 | |||
| Total | 28 | 0.0058 | |||||
| Diencephalon | |||||||
| Csize | 1 | 0.0006 | 0.0006 | 0.060 | 1.74 | 1.26 | 0.106 |
| foraging_mode | 2 | 0.0008 | 0.0004 | 0.077 | 1.11 | 0.39 | 0.349 |
| Residuals | 25 | 0.0092 | 0.0004 | 0.863 | |||
| Total | 28 | 0.0107 | |||||
| Cerebellum | |||||||
| Csize | 1 | 0.0014 | 0.0014 | 0.073 | 2.15 | 1.51 | 0.057 |
| foraging_mode | 2 | 0.0014 | 0.0007 | 0.075 | 1.11 | 0.48 | 0.317 |
| Residuals | 25 | 0.0161 | 0.0006 | 0.851 | |||
| Total | 28 | 0.0189 | |||||
|
1
df, degree of freedom.
2
SS, sum of squares.
3
MS, mean squares.
4
Significant values (p-value < 0.05) from permutation tests (1,000 permutation rounds) are bolded.
|
|||||||
PGLS of regional brain size and foraging mode RESULTS: Affects on all regions except the mesencephalon
pgls_csize <- procD.pgls(prop$c ~ foraging_mode, phy = lzrd_tree, data=c.gdf, iter=999, print.progress = FALSE)
pgls_dsize <- procD.pgls(prop$d ~ foraging_mode, phy = lzrd_tree, data=d.gdf, iter=999, print.progress = FALSE)
pgls_mdsize <- procD.pgls(prop$md ~ foraging_mode, phy = lzrd_tree, data=md.gdf, iter=999, print.progress = FALSE)
pgls_mssize <- procD.pgls(prop$ms ~ foraging_mode, phy = lzrd_tree, data=ms.gdf, iter=999, print.progress = FALSE)
pgls_tsize <- procD.pgls(prop$t ~ foraging_mode, phy = lzrd_tree, data=t.gdf, iter=999, print.progress = FALSE)
| Regional Brain Size | |||||||
|---|---|---|---|---|---|---|---|
| Source | df1 | SS2 | MS3 | Rsq | F | Z | p-value4 |
| Telencephalon | |||||||
| foraging_mode | 2 | 0.0004 | 0.0002 | 0.483 | 12.15 | 3.14 | 0.001 |
| Residuals | 26 | 0.0004 | 0.0000 | 0.517 | |||
| Total | 28 | 0.0008 | |||||
| Mesencephalon | |||||||
| foraging_mode | 2 | 0.0001 | 0.0000 | 0.089 | 1.27 | 0.61 | 0.279 |
| Residuals | 26 | 0.0006 | 0.0000 | 0.911 | |||
| Total | 28 | 0.0007 | |||||
| Medulla Oblongata | |||||||
| foraging_mode | 2 | 0.0001 | 0.0000 | 0.412 | 9.12 | 3.29 | 0.001 |
| Residuals | 26 | 0.0001 | 0.0000 | 0.588 | |||
| Total | 28 | 0.0002 | |||||
| Diencephalon | |||||||
| foraging_mode | 2 | 0.0000 | 0.0000 | 0.197 | 3.19 | 1.65 | 0.045 |
| Residuals | 26 | 0.0001 | 0.0000 | 0.803 | |||
| Total | 28 | 0.0001 | |||||
| Cerebellum | |||||||
| foraging_mode | 2 | 0.0001 | 0.0000 | 0.210 | 3.46 | 1.72 | 0.044 |
| Residuals | 26 | 0.0002 | 0.0000 | 0.790 | |||
| Total | 28 | 0.0003 | |||||
|
1
df, degree of freedom.
2
SS, sum of squares.
3
MS, mean squares.
4
Significant values (p-value < 0.05) from permutation tests (1,000 permutation rounds) are bolded.
|
|||||||
Correlation matrix between continuous trait variables - included in manuscript
1. Phylogentic Signal
physignal(wb.gpa$coords, lzrd_tree)
##
## Call:
## physignal(A = wb.gpa$coords, phy = lzrd_tree)
##
##
##
## Observed Phylogenetic Signal (K): 0.598
##
## P-value: 0.001
##
## Effect Size: 3.4198
##
## Based on 1000 random permutations
physignal(wb.gpa$Csize, lzrd_tree)
##
## Call:
## physignal(A = wb.gpa$Csize, phy = lzrd_tree)
##
##
##
## Observed Phylogenetic Signal (K): 0.5364
##
## P-value: 0.232
##
## Effect Size: 0.7312
##
## Based on 1000 random permutations
2. Allometry of CSize and Shape - the results are in our shape pgls because we control for size
pgls_allom <- procD.pgls(coords ~ Csize, phy = lzrd_tree, data=wb.gdf, iter=999,
print.progress = FALSE)
| Allometry | |||||||
|---|---|---|---|---|---|---|---|
| Source | df1 | SS2 | MS3 | Rsq | F | Z | p-value4 |
| Csize | 1 | 0.0017 | 0.0017 | 0.162 | 5.24 | 3.08 | 0.001 |
| Residuals | 27 | 0.0087 | 0.0003 | 0.838 | |||
| Total | 28 | 0.0104 | |||||
|
1
df, degree of freedom.
2
SS, sum of squares.
3
MS, mean squares.
4
Significant values (p-value < 0.05) from permutation tests (1,000 permutation rounds) are bolded.
|
|||||||