Bayesian Mixing Models in R

Creates and runs Bayesian mixing models to analyze biotracer data (i.e. stable isotopes, fatty acids), which estimate the proportions of source (prey) contributions to a mixture (consumer). 'MixSIAR' is not one model, but a framework that allows a user to create a mixing model based on their data structure and research questions, via options for fixed/ random effects, source data types, priors, and error terms. 'MixSIAR' incorporates several years of advances since 'MixSIR' and 'SIAR', and includes both GUI (graphical user interface) and script versions.


MixSIAR is an R package that helps you create and run Bayesian mixing models to analyze biotracer data (i.e. stable isotopes, fatty acids), following the MixSIAR model framework. Both graphical user interface (GUI) and script versions are available.

MixSIAR represents a collaborative coding project between the investigators behind MixSIR and SIAR: Brice Semmens, Brian Stock, Eric Ward, Andrew Parnell, Donald Phillips, Andrew Jackson, Jon Moore, Stuart Bearhop, and Richard Inger.

MixSIAR incorporates several years of advances in Bayesian mixing model theory since MixSIR and SIAR, currently:

  • Any number of biotracers (examples with 1 isotope, 2 isotope, 8 fatty acids, and 22 fatty acids)
  • Source data fit hierarchically within the model
  • Source data by categorical covariate (e.g. sources by Region)
  • Categorical covariates (up to 2, choice of modeling as random or fixed effects, either nested or independent)
  • Continuous covariate (up to 1)
  • Error structure options with covariance (Residual * Process, Residual only)
  • Concentration dependence
  • Ability to plot and include “uninformative”/generalist or informative priors

The script version is easier to install and better for repeated analysis. If you want the script version only (no GUI):

  1. Download and install/update R.

  2. Download and install JAGS.

  3. Open R and run:

install.packages("MixSIAR")
library(MixSIAR)

The vignettes can be accessed via:

browseVignettes("MixSIAR")

There is a more extensive user manual included in the package install. To find the directory location on your computer:

find.package("MixSIAR")

The manual is also available from the GitHub site here.

Getting the GUI running is more work, but can be a nice introduction to MixSIAR. The install instructions are platform-specific:

  1. Download and install/update R.

  2. Download and install JAGS.

  3. Open R.

  4. Install GTK+ dependent packages:

    install.packages(c("gWidgets", "RGtk2", "gWidgetsRGtk2"))
  5. Load RGtk2. You will be prompted to install GTK+. Follow the automatic prompts and do not interrupt the GTK+ installation!:

    library(RGtk2)
  6. Restart R and run:

    install.packages("MixSIAR", dependencies=TRUE)
  7. Load MixSIAR and run GUI:

    library(MixSIAR)
    mixsiar_gui()

There is an extensive user manual included in the package install. To find the directory location on your computer:

find.package("MixSIAR")

Alternatively, you can download the manual from the GitHub site here.

  1. Download and install/update R.

  2. Download and install JAGS.

  3. Open R.

  4. Install GTK+ dependent R packages:

    install.packages(c("gWidgets", "RGtk2", "gWidgetsRGtk2"))
  5. Close R.

  6. Download and install the newest GTK+ framework.

  7. Install the latest X11 application, xQuartz.

  8. Open R and run:

    install.packages("MixSIAR", dependencies=TRUE)
  9. Load MixSIAR and run GUI:

    library(MixSIAR)
    mixsiar_gui()

There is an extensive user manual included in the package install. To find the directory location on your computer:

find.package("MixSIAR")

Alternatively, you can download the manual from the GitHub site here.

  1. Download and install/update R.

  2. Download and install JAGS. Or, from the terminal: sudo apt-get install jags r-cran-rjags.

  3. Download and install GTK+ framework. From the terminal: sudo apt-get install libgtk2.0-dev.

  4. Check if GTK+ is installed correctly. Open R, install and load the RGtk2 package with:

    install.packages("RGtk2")
    library(RGtk2)
  5. Install MixSIAR:

    install.packages("MixSIAR", dependencies=TRUE)
  6. Load MixSIAR and run GUI:

    library(MixSIAR)
    mixsiar_gui()

There is an extensive user manual included in the package install. To find the directory location on your computer:

find.package("MixSIAR")

Alternatively, you can download the manual from the GitHub site here.

This software has been improved by the questions, suggestions, and bug reports of the user community. If you have a comment, ideally use the Issues page. You can also post to the SIAR facebook group or shoot me an email (b1stock@ucsd.edu).

If you use MixSIAR results in publications, please cite the MixSIAR manual as (similar to how you cite R):

The primary citation for Bayesian mixing models (MixSIR):

Moore, J. W., & Semmens, B. X. (2008). Incorporating uncertainty and prior information into stable isotope mixing models. Ecology Letters, 11(5), 470-480.

If you are using the residual error term (SIAR):

Parnell, A. C., Inger, R., Bearhop, S., & Jackson, A. L. (2010). Source partitioning using stable isotopes: coping with too much variation. PLoS One, 5(3), e9672.

If you are using a hierarchical structure/random effects:

Semmens, B. X., Ward, E. J., Moore, J. W., & Darimont, C. T. (2009). Quantifying inter-and intra-population niche variability using hierarchical Bayesian stable isotope mixing models. PLoS One, 4(7), e6187.

If you are using continuous effects:

Francis, T. B., Schindler, D. E., Holtgrieve, G. W., Larson, E. R., Scheuerell, M. D., Semmens, B. X., & Ward, E. J. (2011). Habitat structure determines resource use by zooplankton in temperate lakes. Ecology letters, 14(4), 364-372.

If you are using source fitting:

Ward, E. J., Semmens, B. X., & Schindler, D. E. (2010). Including source uncertainty and prior information in the analysis of stable isotope mixing models. Environmental science & technology, 44(12), 4645-4650.

For a detailed description of the math underlying these models, see:

Parnell, A. C., Phillips, D. L., Bearhop, S., Semmens, B. X., Ward, E. J., Moore, J. W., Jackson, A. L., Grey, J., Kelley, D. J., & Inger, R. (2013). Bayesian stable isotope mixing models. Environmetrics, 24, 387-399.

Finally... yes, a paper introducing MixSIAR is in the works and will be forthcoming shortly.

If for some reason you can't install using install.packages, the GitHub version is another option.

  1. Download and install/update R.

  2. Download and install JAGS.

  3. (Optional) If you want to build the vignettes, install pandoc or R Studio.

  4. Open R.

  5. Install GTK+ dependent packages:

    install.packages(c("gWidgets", "RGtk2", "gWidgetsRGtk2", "devtools"))
  6. Load RGtk2. You will be prompted to install GTK+. Follow the automatic prompts and do not interrupt the GTK+ installation!:

    library(RGtk2)
  7. Restart R and run:

    library(devtools)
    devtools::install_github("brianstock/MixSIAR@*release", # gets latest release
                             dependencies = TRUE, 
                             build_vignettes = TRUE) # FALSE if no pandoc/R Studio
  8. Load MixSIAR and run GUI:

    library(MixSIAR)
    mixsiar_gui()
  1. Download and install/update R.

  2. Download and install JAGS.

  3. (Optional) If you want to build the vignettes, install pandoc or R Studio.

  4. Open R.

  5. Install GTK+ dependent R packages:

    install.packages(c("gWidgets", "RGtk2", "gWidgetsRGtk2", "devtools"))
  6. Close R.

  7. Download and install the newest GTK+ framework.

  8. Install the latest X11 application, xQuartz.

  9. Open R and run:

    library(devtools)
    devtools::install_github("brianstock/MixSIAR@*release", # gets latest release
                             dependencies = TRUE, 
                             build_vignettes = TRUE) # FALSE if no pandoc/R Studio
  10. Load MixSIAR and run GUI:

    library(MixSIAR)
    mixsiar_gui()
  1. Download and install/update R.

  2. Download and install JAGS. Or, from the terminal: sudo apt-get install jags r-cran-rjags.

  3. Download and install GTK+ framework. From the terminal: sudo apt-get install libgtk2.0-dev.

  4. (Optional) If you want to build the vignettes, install pandoc or R Studio.

  5. Check if GTK+ is installed correctly. Open R, install and load the RGtk2 package with:

    install.packages("RGtk2")
    library(RGtk2)
  6. Install and load devtools, then install MixSIAR:

    install.packages("devtools")
    library(devtools)
    devtools::install_github("brianstock/MixSIAR@*release", # gets latest release
                             dependencies = TRUE, 
                             build_vignettes = TRUE) # FALSE if no pandoc and pandoc-citeproc
  7. Load MixSIAR and run GUI:

    library(MixSIAR)
    mixsiar_gui()

News

MixSIAR 3.1.7 (2016-08-15)

  • Changed resid.prop prior from dchisqr(3) to dunif(0,20)
  • Updated install instructions in README (install.packages)
  • Fixed error in Cladocera vignette (process vs. resid error)
  • Fixed link to manual to CRAN page (DESCRIPTION file)

MixSIAR 3.1.6 (2016-06-24)

  • CRAN submission
  • added files for CRAN submission (cran-comments.md, NEWS.md)
  • fixed broken links found when checking for CRAN submission

MixSIAR 3.1.5 (2016-06-21)

  • Changed "Isotopes" to "Tracers" in GUI

MixSIAR 3.1.4 (2016-06-21)

  • Fixed bug #72 by using utils::globalVariables(), created when making changes to pass R CMD check for CRAN submission

MixSIAR 3.1.3 (2016-06-01)

  • Tests via testthat package (see "tests/testthat" folder)
  • Changes to pass R CMD check for submission to CRAN

MixSIAR 3.1.2 (2016-03-16)

  • download latest release by default (instead of master)
  • updated citation info

MixSIAR 3.1.1 (2016-03-11)

  • Added vignettes for script examples, see browseVignettes("MixSIAR")
  • Tested package install on Windows, Mac, Linux
  • Revised install instructions
  • Couple minor bug fixes
  • Revised manual

MixSIAR 3.1.0 (2016-03-09)

  • Converted to R package structure, so can now run MixSIAR with:

library(MixSIAR) mixsiar_gui()

MixSIAR 3.0.2 (2015-11-19)

  • Problem loading mix/consumer data in the GUI version (#48)

MixSIAR 3.0.1 (2015-10-29)

  • Fixed an error that applies with source data = means and the "Resid*Process" error structure (affects Wolves, Killer whale, and Isopod examples)

MixSIAR 3.0.0 (2015-10-29)

  • error structures now multivariate, with 3 options: "Residual only", "Residual * Process", "Process only (N=1)"
  • fixed coding of fixed effects (cases with 2FE, 1FE + 1RE)
  • new function plot_prior to plot uninformative vs. informative priors (included in GUI)
  • new function calc_area to calculate Brett (2014) normalized surface area
  • normalized continuous covariate
  • MCMC chains given different initial values (#35)
  • added new examples with fatty acids
  • new manual

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("MixSIAR")

3.1.7 by Brian Stock, 8 months ago


https://github.com/brianstock/MixSIAR


Report a bug at https://github.com/brianstock/MixSIAR/issues


Browse source code at https://github.com/cran/MixSIAR


Authors: Brian Stock [cre, aut], Brice Semmens [aut], Eric Ward [ctb], Andrew Parnell [ctb], Andrew Jackson [ctb], Donald Phillips [ctb], Jon Moore [ctb], Stuart Bearhop [ctb], Richard Inger [ctb]


Documentation:   PDF Manual  


GPL-3 license


Imports ggplot2, rjags, R2jags, MASS, RColorBrewer, reshape, reshape2, lattice, compositions, ggmcmc, coda

Suggests gWidgets, gWidgetsRGtk2, splancs, knitr, rmarkdown, testthat

System requirements: JAGS (>= 4.1) for the script version, both JAGS and GTK+ for the GUI version. For install instructions, see README file.


See at CRAN