Age, vocal learning and FoxP2 in budgerigards

Author

Marcelo Araya-Salas

Published

September 20, 2023

Data analysis for the paper:

B Moussaoui, K Ulmer, M Araya-Salas, TF Wright. In review. Persistent vocal learning in an aging open-ended learner reflected in neural FoxP2 expression

 

Source code and data found at https://github.com/maRce10/Age-vocal-learning-and-foxp2-in-budgies

1 Purpose

  • Testing for correlation between vocal measures and FoxP2 MMST/VSP Protein Expression and Expression Difference with Age

 

2 Load packages

Code
# knitr is require for creating html/pdf/word reports load
# function from sketchy
source("https://raw.githubusercontent.com/maRce10/sketchy/main/R/load_packages.R")

# install/ load packages
load_packages(packages = c("ggplot2", "tidyverse", "cowplot", "pwr",
    "brms", "viridis"))

my.viridis <- function(...) viridis(alpha = 0.5, begin = 0.3, end = 0.7,
    ...)

source("https://raw.githubusercontent.com/maRce10/brmsish/master/R/extended_summary.R")
source("https://raw.githubusercontent.com/maRce10/brmsish/master/R/helpers.R")
source("https://raw.githubusercontent.com/maRce10/brmsish/master/R/check_rds_fits.R")

3 Load data

Code
voc_brain_corr <- read.csv("./data/raw/Vocal_Brain_Corr_03_09_2023_Final.csv",
    header = TRUE)
head(voc_brain_corr)
full.ID slide hemisphere mmst.vsp ID record.block call.count acoustic.area acoustic.distance acoustic.overlap acoustic.overlap.to.group treatment round socialgroup
268YGHM 3C LH 0.7288846 10C 5 258 -1.0023572 54.05433 0.7843412 0.8532292 Old 3 10
302YGHM 3C RH 1.2453740 12C 5 4 NA NA NA NA Old 3 12
240YGHM 4B RH 0.6630428 2C 5 0 NA NA NA NA Old 1 2
449YGLM 3C RH 0.5980095 1D 5 208 -0.4912392 59.24501 0.5769869 0.5787511 Young 1 1
450WBHM 4C LH 0.5743955 3B 5 70 0.5124279 64.53984 0.1448734 0.6599006 Young 1 3
444YBHM 4B RH 0.4612990 12D 5 6 -0.6911194 63.83162 0.1212067 0.2495599 Old 3 12

We can take 1 - acoustic.overlap, acoustic.overlap being calculated as the intersect over union of an individual’s beginning and ending acoustic spaces, to be able to represent vocal plasticity such that higher values representing a more plastic vocal repertoire.

- vocal.plasticity = (1-acoustic.overlap)
Code
voc_brain_corr$vocal.plasticity <- (1 - (voc_brain_corr$acoustic.overlap))

4 Exploratory graphs

Code
voc_brain_corr$treatment <- factor(voc_brain_corr$treatment, levels = c("Young",
    "Old"))

# Visualize data
theme_set(theme_classic())
area.change <- ggplot(voc_brain_corr, aes(x = mmst.vsp, y = acoustic.area,
    colour = treatment)) + geom_point(size = 6) + geom_smooth(method = "lm",
    se = FALSE, size = 1.5) + labs(y = "Vocal diversity", x = "FoxP2 MMSt/VSP expression",
    color = "Adult age") + theme(text = element_text(size = 20), axis.line = element_line(colour = "black",
    size = 1.5), axis.ticks = element_line(colour = "black", size = 1.5),
    axis.text = element_text(colour = "black")) + scale_color_viridis_d(begin = 0.2,
    end = 0.8, alpha = 0.5) + coord_cartesian(xlim = c(0.25, 1.25))
area.change

Code
ggsave("./output/FOXP2_VocalDiversity_Correlation_Final_03_09_2023.png",
    width = 7, height = 6, units = "in")

overlap.self <- ggplot(voc_brain_corr, aes(x = mmst.vsp, y = vocal.plasticity,
    colour = treatment)) + geom_point(size = 6) + geom_smooth(method = "lm",
    se = FALSE, size = 1.5) + labs(y = "Vocal plasticity", x = "FoxP2 MMSt/VSP expression",
    color = "Adult age") + theme(text = element_text(size = 20), axis.line = element_line(colour = "black",
    size = 1.5), axis.ticks = element_line(colour = "black", size = 1.5),
    axis.text = element_text(colour = "black")) + scale_color_viridis_d(begin = 0.2,
    end = 0.8, alpha = 0.5) + coord_cartesian(xlim = c(0.25, 1.25),
    ylim = c(0, 1))
overlap.self

Code
ggsave("./output/FOXP2_VocalPlasticity_Correlation_Final__03_09_2023.png",
    width = 7, height = 6, units = "in")

overlap.group <- ggplot(voc_brain_corr, aes(x = mmst.vsp, y = acoustic.overlap.to.group,
    colour = treatment)) + geom_point(size = 6) + geom_smooth(method = "lm",
    se = FALSE, size = 1.5) + labs(y = "Vocal convergence", x = "FoxP2 MMSt/VSP expression",
    color = "Adult age") + theme(text = element_text(size = 20), axis.line = element_line(colour = "black",
    size = 1.5), axis.ticks = element_line(colour = "black", size = 1.5),
    axis.text = element_text(colour = "black")) + scale_color_viridis_d(begin = 0.2,
    end = 0.8, alpha = 0.5) + coord_cartesian(xlim = c(0.25, 1.25),
    ylim = c(0, 1))
overlap.group

Code
ggsave("./output/FOXP2_VocalConvergence_Correlation_Final__03_03_2023.png",
    width = 7, height = 6, units = "in")

5 Statistical analysis

5.1 Models without age as a predictor

5.1.1 Fit models

Code
iter <- 20000
chains <- 4
priors <- c(prior(normal(0, 6), class = "b"))

# mean center expression
voc_brain_corr$mmst.vsp_cntr <- voc_brain_corr$mmst.vsp - mean(voc_brain_corr$mmst.vsp)


# cmdstanr::set_cmdstan_path('~/Documentos/cmdstan/')

# to run within-chain parallelization
model.01 <- brm(formula = acoustic.area ~ mmst.vsp_cntr, data = voc_brain_corr,
    prior = priors, iter = iter, chains = chains, cores = chains,
    control = list(adapt_delta = 0.99, max_treedepth = 15), file = "./data/processed/regression_model_acoustic_area_by_expression.RDS",
    file_refit = "always")

model.02 <- brm(formula = vocal.plasticity ~ mmst.vsp_cntr, data = voc_brain_corr,
    prior = priors, iter = iter, chains = chains, cores = chains,
    family = Beta(), control = list(adapt_delta = 0.99, max_treedepth = 15),
    file = "./data/processed/regression_model_vocal_plasticity_by_expression.RDS",
    file_refit = "always")

model.03 <- brm(formula = acoustic.overlap.to.group ~ mmst.vsp_cntr,
    data = voc_brain_corr, prior = priors, iter = iter, chains = chains,
    cores = chains, family = Beta(), control = list(adapt_delta = 0.99,
        max_treedepth = 15), file = "./data/processed/regression_model_vocal_overlap_to_group_by_expression.RDS",
    file_refit = "always")

5.1.2 Change in acoustic area (diversity)

Code
mod <- readRDS("./data/processed/regression_model_acoustic_area_by_expression.RDS")

extended_summary(mod, n.posterior = 1000, fill = viridis(10)[7], trace.palette = my.viridis,
    remove.intercepts = TRUE, highlight = TRUE, print.name = FALSE)
priors formula iterations chains thinning warmup diverg_transitions rhats > 1.05 min_bulk_ESS min_tail_ESS seed
1 b-normal(0, 6) Intercept-student_t(3, -0.2, 2.5) sigma-student_t(3, 0, 2.5) acoustic.area ~ mmst.vsp 20000 4 1 10000 0 0 26129.29 22608.58 522435807
Estimate l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
b_mmst.vsp -1.332 -4.119 1.427 1 26129.29 22608.58

5.1.3 Overlap of acoustic area to self (plasticity)

Code
mod <- readRDS("./data/processed/regression_model_vocal_plasticity_by_expression.RDS")

extended_summary(mod, n.posterior = 1000, fill = viridis(10)[7], trace.palette = my.viridis,
    remove.intercepts = TRUE, highlight = TRUE, print.name = FALSE)
priors formula iterations chains thinning warmup diverg_transitions rhats > 1.05 min_bulk_ESS min_tail_ESS seed
1 b-normal(0, 6) Intercept-student_t(3, 0, 2.5) phi-gamma(0.01, 0.01) vocal.plasticity ~ mmst.vsp 20000 4 1 10000 0 0 27891.23 24301.27 2049232364
Estimate l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
b_mmst.vsp -1.877 -4.308 0.563 1 27891.23 24301.27

5.1.4 Overlap to group acoustic area (convergence)

Code
mod <- readRDS("./data/processed/regression_model_vocal_overlap_to_group_by_expression.RDS")

extended_summary(mod, n.posterior = 1000, fill = viridis(10)[7], trace.palette = my.viridis,
    remove.intercepts = TRUE, highlight = TRUE, print.name = FALSE)
priors formula iterations chains thinning warmup diverg_transitions rhats > 1.05 min_bulk_ESS min_tail_ESS seed
1 b-normal(0, 6) Intercept-student_t(3, 0, 2.5) phi-gamma(0.01, 0.01) acoustic.overlap.to.group ~ mmst.vsp 20000 4 1 10000 0 0 26532.49 23141.36 975761282
Estimate l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
b_mmst.vsp -0.46 -2.917 1.969 1 26532.49 23141.36

5.2 Models with foxp2 expression & age as predictors

5.2.1 Fit models

Code
# to run within-chain parallelization
model.01 <- brm(formula = acoustic.area ~ mmst.vsp_cntr * treatment,
    data = voc_brain_corr, prior = priors, iter = iter, chains = chains,
    cores = chains, control = list(adapt_delta = 0.99, max_treedepth = 15),
    file = "./data/processed/regression_model_acoustic_area_by_expression_and_treatment.RDS",
    file_refit = "always")

model.02 <- brm(formula = vocal.plasticity ~ mmst.vsp_cntr * treatment,
    data = voc_brain_corr, prior = priors, iter = iter, chains = chains,
    cores = chains, family = Beta(), control = list(adapt_delta = 0.99,
        max_treedepth = 15), file = "./data/processed/regression_model_vocal_plasticity_by_expression_and_treatment.RDS",
    file_refit = "always")

model.03 <- brm(formula = acoustic.overlap.to.group ~ mmst.vsp_cntr *
    treatment, data = voc_brain_corr, prior = priors, iter = iter,
    chains = chains, cores = chains, family = Beta(), control = list(adapt_delta = 0.99,
        max_treedepth = 15), file = "./data/processed/regression_model_vocal_overlap_to_group_by_expression_and_treatment.RDS",
    file_refit = "always")

5.2.2 Change in acoustic area (diversity)

Code
mod <- readRDS("./data/processed/regression_model_acoustic_area_by_expression_and_treatment.RDS")

extended_summary(mod, n.posterior = 1000, fill = viridis(10)[7], trace.palette = my.viridis,
    remove.intercepts = TRUE, highlight = TRUE, print.name = FALSE)
priors formula iterations chains thinning warmup diverg_transitions rhats > 1.05 min_bulk_ESS min_tail_ESS seed
1 b-normal(0, 6) Intercept-student_t(3, -0.2, 2.5) sigma-student_t(3, 0, 2.5) acoustic.area ~ mmst.vsp * treatment 20000 4 1 10000 0 0 22396.79 23714.6 2089431769
Estimate l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
b_mmst.vsp -0.461 -3.672 2.717 1 22396.79 23800.46
b_treatmentOld -1.071 -1.974 -0.172 1 26400.18 23714.60
b_mmst.vsp:treatmentOld -0.747 -5.444 3.979 1 22457.77 24351.84

5.2.3 Overlap of acoustic area to self (plasticity)

Code
mod <- readRDS("./data/processed/regression_model_vocal_plasticity_by_expression_and_treatment.RDS")

extended_summary(mod, n.posterior = 1000, fill = viridis(10)[7], trace.palette = my.viridis,
    remove.intercepts = TRUE, highlight = TRUE, print.name = FALSE)
priors formula iterations chains thinning warmup diverg_transitions rhats > 1.05 min_bulk_ESS min_tail_ESS seed
1 b-normal(0, 6) Intercept-student_t(3, 0, 2.5) phi-gamma(0.01, 0.01) vocal.plasticity ~ mmst.vsp * treatment 20000 4 1 10000 0 0 25560.43 25161.79 1695463494
Estimate l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
b_mmst.vsp -1.564 -4.795 1.603 1 25924.28 25161.79
b_treatmentOld 0.080 -0.816 0.969 1 32070.14 26480.02
b_mmst.vsp:treatmentOld -0.901 -5.651 3.935 1 25560.43 26051.82

5.2.4 Overlap to group acoustic area (convergence)

Code
mod <- readRDS("./data/processed/regression_model_vocal_overlap_to_group_by_expression_and_treatment.RDS")

extended_summary(mod, n.posterior = 1000, fill = viridis(10)[7], trace.palette = my.viridis,
    remove.intercepts = TRUE, highlight = TRUE, print.name = FALSE)
priors formula iterations chains thinning warmup diverg_transitions rhats > 1.05 min_bulk_ESS min_tail_ESS seed
1 b-normal(0, 6) Intercept-student_t(3, 0, 2.5) phi-gamma(0.01, 0.01) acoustic.overlap.to.group ~ mmst.vsp * treatment 20000 4 1 10000 0 0 22934.24 23739.57 1949232911
Estimate l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
b_mmst.vsp -0.506 -3.586 2.669 1 22934.24 25361.57
b_treatmentOld -0.677 -1.499 0.167 1 30198.94 26179.80
b_mmst.vsp:treatmentOld 1.079 -3.632 5.598 1 23810.30 23739.57

5.3 Combined model metadata

Code
check_rds_fits(path = "./data/processed/", html = TRUE)
priors formula iterations chains thinning warmup diverg_transitions rhats > 1.05 min_bulk_ESS min_tail_ESS seed
1 b-normal(0, 6) Intercept-student_t(3, -0.2, 2.5) sigma-student_t(3, 0, 2.5) acoustic.area ~ mmst.vsp * treatment 20000 4 1 10000 0 0 14171.34 17583.88 2089431769
2 b-normal(0, 6) Intercept-student_t(3, -0.2, 2.5) sigma-student_t(3, 0, 2.5) acoustic.area ~ mmst.vsp 20000 4 1 10000 0 0 14451.03 17861.79 522435807
3 b-normal(0, 6) Intercept-student_t(3, 0, 2.5) phi-gamma(0.01, 0.01) acoustic.overlap.to.group ~ mmst.vsp * treatment 20000 4 1 10000 0 0 16038.48 21693.90 1949232911
4 b-normal(0, 6) Intercept-student_t(3, 0, 2.5) phi-gamma(0.01, 0.01) acoustic.overlap.to.group ~ mmst.vsp 20000 4 1 10000 0 0 15631.16 19585.55 975761282
5 b-normal(0, 6) Intercept-student_t(3, 0, 2.5) phi-gamma(0.01, 0.01) vocal.plasticity ~ mmst.vsp * treatment 20000 4 1 10000 0 0 16185.23 21349.07 1695463494
6 b-normal(0, 6) Intercept-student_t(3, 0, 2.5) phi-gamma(0.01, 0.01) vocal.plasticity ~ mmst.vsp 20000 4 1 10000 0 0 15620.36 20131.26 2049232364

Takeaways

  • Lower diversity in old birds

 


5.4 Posterior predictive checks

Check reilability of Bayesian models

Code
model_list <- c(divergence = "./data/processed/regression_model_acoustic_area_by_expression.RDS",
    plasticity = "./data/processed/regression_model_vocal_plasticity_by_expression.RDS",
    convergence = "./data/processed/regression_model_vocal_overlap_to_group_by_expression.RDS",
    divergence_interaction = "./data/processed/regression_model_acoustic_area_by_expression_and_treatment.RDS",
    plasticity_interaction = "./data/processed/regression_model_vocal_plasticity_by_expression_and_treatment.RDS",
    convergence_interaction = "./data/processed/regression_model_vocal_overlap_to_group_by_expression_and_treatment.RDS")

ndraws <- 20

for (i in seq_len(length(model_list))) {
    cat("\n\n## ", names(model_list)[i], "\n\n")

    fit <- readRDS(model_list[[i]])
    ppc_dens <- pp_check(fit, ndraws = ndraws, type = "dens_overlay")  # shows dens_overlay plot by default
    pp_mean <- pp_check(fit, type = "stat", stat = "mean", ndraws = ndraws)
    pp_scat <- pp_check(fit, type = "scatter_avg", ndraws = ndraws)
    pp_stat2 <- pp_check(fit, type = "stat_2d", ndraws = ndraws)
    pp_loo <- pp_check(fit, type = "loo_pit_qq", ndraws = ndraws)
    pp_error <- pp_check(fit, type = "error_scatter_avg", ndraws = ndraws)
    plot_l <- list(ppc_dens, pp_mean, pp_scat, pp_error, pp_stat2,
        pp_loo)

    plot_l <- lapply(plot_l, function(x) x + scale_color_viridis_d(begin = 0.1,
        end = 0.8, alpha = 0.5) + scale_fill_viridis_d(begin = 0.1,
        end = 0.8, alpha = 0.5) + theme_classic())

    print(plot_grid(plotlist = plot_l, ncol = 2))
}

5.5 divergence

5.6 plasticity

5.7 convergence

5.8 divergence_interaction

5.9 plasticity_interaction

5.10 convergence_interaction

 

Session information

R version 4.1.0 (2021-05-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3

locale:
 [1] LC_CTYPE=pt_BR.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=es_CR.UTF-8        LC_COLLATE=pt_BR.UTF-8    
 [5] LC_MONETARY=es_CR.UTF-8    LC_MESSAGES=pt_BR.UTF-8   
 [7] LC_PAPER=es_CR.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=es_CR.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] viridis_0.6.4     viridisLite_0.4.2 brms_2.18.0       Rcpp_1.0.11      
 [5] pwr_1.3-0         cowplot_1.1.1     forcats_0.5.1     stringr_1.5.0    
 [9] dplyr_1.0.10      purrr_1.0.0       readr_2.1.3       tidyr_1.1.3      
[13] tibble_3.2.1      tidyverse_1.3.1   ggplot2_3.4.3    

loaded via a namespace (and not attached):
  [1] readxl_1.3.1         backports_1.4.1      systemfonts_1.0.4   
  [4] plyr_1.8.7           igraph_1.5.1         splines_4.1.0       
  [7] crosstalk_1.2.0      TH.data_1.1-0        rstantools_2.2.0    
 [10] inline_0.3.19        digest_0.6.33        htmltools_0.5.6     
 [13] fansi_1.0.4          magrittr_2.0.3       checkmate_2.2.0     
 [16] tzdb_0.3.0           modelr_0.1.8         RcppParallel_5.1.5  
 [19] matrixStats_0.62.0   svglite_2.1.0        xts_0.12.2          
 [22] sandwich_3.0-1       prettyunits_1.1.1    colorspace_2.1-0    
 [25] rvest_1.0.3          ggdist_3.2.0         textshaping_0.3.5   
 [28] haven_2.4.1          xfun_0.40            callr_3.7.3         
 [31] crayon_1.5.2         jsonlite_1.8.7       lme4_1.1-27.1       
 [34] survival_3.2-11      zoo_1.8-11           glue_1.6.2          
 [37] kableExtra_1.3.4     gtable_0.3.4         emmeans_1.8.1-1     
 [40] webshot_0.5.4        distributional_0.3.1 pkgbuild_1.4.0      
 [43] rstan_2.21.7         abind_1.4-5          scales_1.2.1        
 [46] mvtnorm_1.1-3        DBI_1.1.3            miniUI_0.1.1.1      
 [49] xtable_1.8-4         stats4_4.1.0         StanHeaders_2.21.0-7
 [52] DT_0.26              htmlwidgets_1.5.4    httr_1.4.4          
 [55] threejs_0.3.3        posterior_1.3.1      ellipsis_0.3.2      
 [58] pkgconfig_2.0.3      loo_2.4.1.9000       farver_2.1.1        
 [61] dbplyr_2.1.1         utf8_1.2.3           labeling_0.4.2      
 [64] tidyselect_1.2.0     rlang_1.1.1          reshape2_1.4.4      
 [67] later_1.3.0          munsell_0.5.0        cellranger_1.1.0    
 [70] tools_4.1.0          cli_3.6.1            generics_0.1.3      
 [73] broom_0.7.8          ggridges_0.5.4       evaluate_0.21       
 [76] fastmap_1.1.1        ragg_1.1.3           yaml_2.3.7          
 [79] processx_3.8.2       knitr_1.43           fs_1.6.3            
 [82] pbapply_1.7-2        nlme_3.1-162         mime_0.12           
 [85] projpred_2.0.2       formatR_1.11         xml2_1.3.5          
 [88] compiler_4.1.0       bayesplot_1.9.0      shinythemes_1.2.0   
 [91] rstudioapi_0.14      gamm4_0.2-6          reprex_2.0.0        
 [94] stringi_1.7.12       ps_1.7.5             Brobdingnag_1.2-9   
 [97] lattice_0.21-8       Matrix_1.5-4.1       nloptr_1.2.2.2      
[100] markdown_1.3         shinyjs_2.1.0        tensorA_0.36.2      
[103] vctrs_0.6.3          pillar_1.9.0         lifecycle_1.0.3     
[106] bridgesampling_1.1-2 estimability_1.4.1   httpuv_1.6.6        
[109] R6_2.5.1             promises_1.2.0.1     gridExtra_2.3       
[112] codetools_0.2-18     boot_1.3-28          colourpicker_1.2.0  
[115] MASS_7.3-60          gtools_3.9.3         assertthat_0.2.1    
[118] withr_2.5.0          shinystan_2.6.0      multcomp_1.4-17     
[121] mgcv_1.8-42          parallel_4.1.0       hms_1.1.2           
[124] grid_4.1.0           coda_0.19-4          minqa_1.2.4         
[127] rmarkdown_2.23       shiny_1.7.3          lubridate_1.7.10    
[130] base64enc_0.1-3      dygraphs_1.1.1.6