Skip to content

xbouteiller/BayesMix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BayesMix: A R/JAGS Bayesian mixed model for analyzing quantitative genetics data

Preamble:

This code was successfully tested on my dataset. Please contact Xavier Bouteiller at xavier.bouteiller(at)u-bordeaux(dot)fr with bug reports or questions.

Readme:

Here I provide a R/JAGS code for analysing quantitative genetics data using a mixed model that allows to compute Qst quantitative trait differentiation index.

This repository contains:

  • mixed_model.txt: code of the model:
    • This file contains the two versions of the model (i.e. within and between chambers)
  • Script_R.r: Code to execute the model in R
    • use plyr for automatizing computation, parallelization is possible
  • Fun_JAGS.r: R functions for defining input data and initializing computation
  • SampleDataset.txt: a sample data set

Description of the original experimental design:

Original experimental design for which this bayesian mixed model was initially designed is described here. Code can be easily modified for any other experimental design.

This model was used to test for phenotypic differentiation between ranges and populations of a plant cultivated in several temperature conditions. Seeds were harvested in two ranges. In each range ten populations were harvested. Finally in each population seeds were harvested on ten trees, thus seeds of the same tree are a half-sib family. Finally, 5 seeds of each trees were planted in three different temperature conditions. Thus temperature conditions and ranges were considered as fixed effect whereas populations and trees where considered as random effects. To control for maternal effect, mean seed weight calcuted at the family level was used as covariate in the model. Finally, temperature x population interaction was implemented in the model.

Model:

  • Y: Individual phenotypic value for a surveyed trait
  • Fixed effects: temperature (b1) / range (b2)
  • Random effects: population (B3) / tree (B4)
  • Interaction effect (B5): temperature x population
  • covariate parameter: (c) the mean family seed weight as a covariate for maternal effect (c)
  • global mean seed weight (substracted to mean family seed weight in order to center the covariate)

QST estimation:

In order to compute QST, variance within populations () should be separated from variance between populations (). Then for a phenotypic trait, QST can be calculated as follows:

As we used families of half-sibs,variance within populations is 4 times the variance at the tree (i.e. family) level ()

QST can be calculated among the three environments or within each environment depending on the question. Thus, code for implementing the mixed model within or between chambers is provided.

References:

  • Kruschke, J.K., 2015. Doing Bayesian data analysis: a tutorial with R, JAGS, and Stan, Edition 2. ed. Academic Press, Boston.
  • O’Hara, R.B., Merilä, J., 2005. Bias and precision in QST estimates: Problems and some solutions. Genetics 171, 1331–1339.
  • Plummer, M., 2005. JAGS: just another Gibbs sampler. In: Proceedings of the 3rd International Workshop on Distributed Statistical Computing (DSC 2003)
  • R Core Team, 2015. R: A Language and Environment for Statistical Computing.

Publication:

If you are using this Bayesian Mixed Model, please cite:

Bouteiller XP, Barraquand F, Garnier-Géré P, Harmand N, Laizet Y, Raimbault A, Segura R, Lassois L, Monty A, Verdu C, Mariette S & Porté AJ (2018) No evidence for genetic differentiation in juvenile traits between Belgian and French populations of the invasive tree Robinia pseudoacacia. Plant, Ecology and Evolution, 151(1), 5–17. https://doi.org/10.5091/plecevo.2018.1403

About

A Bayesian mixed model for analyzing quantitative genetics data

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages