/
simmr.R
66 lines (66 loc) · 2.3 KB
/
simmr.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#' simmr: A package for fitting stable isotope mixing models via JAGS and
#' FFVB in R
#'
#' This package runs a
#' simple Stable Isotope Mixing Model (SIMM) and is meant as a longer term
#' replacement to the previous function SIAR.. These are used to infer dietary
#' proportions of organisms consuming various food sources from observations on
#' the stable isotope values taken from the organisms' tissue samples. However
#' SIMMs can also be used in other scenarios, such as in sediment mixing or the
#' composition of fatty acids. The main functions are \code{\link{simmr_load}},
#' \code{\link{simmr_mcmc}}, and \code{\link{simmr_ffvb}}. The help files
#' contain examples of the use of this package. See also the vignette for a
#' longer walkthrough.
#'
#' An even longer term replacement for properly running SIMMs is MixSIAR, which
#' allows for more detailed random effects and the inclusion of covariates.
#'
#' @name simmr
#' @aliases simmr-package
#' @author Andrew Parnell <andrew.parnell@mu.ie>
#'
#' @references Andrew C. Parnell, Donald L. Phillips, Stuart Bearhop, Brice X.
#' Semmens, Eric J. Ward, Jonathan W. Moore, Andrew L. Jackson, Jonathan Grey,
#' David J. Kelly, and Richard Inger. Bayesian stable isotope mixing models.
#' Environmetrics, 24(6):387–399, 2013.
#'
#' Andrew C Parnell, Richard Inger, Stuart Bearhop, and Andrew L Jackson.
#' Source partitioning using stable isotopes: coping with too much variation.
#' PLoS ONE, 5(3):5, 2010.
#' @keywords multivariate
#' @examples
#' \donttest{
#' # A first example with 2 tracers (isotopes), 10 observations, and 4 food sources
#' data(geese_data_day1)
#' simmr_in <- with(
#' geese_data_day1,
#' simmr_load(
#' mixtures = mixtures,
#' source_names = source_names,
#' source_means = source_means,
#' source_sds = source_sds,
#' correction_means = correction_means,
#' correction_sds = correction_sds,
#' concentration_means = concentration_means
#' )
#' )
#'
#' # Plot
#' plot(simmr_in)
#'
#' # MCMC run
#' simmr_out <- simmr_mcmc(simmr_in)
#'
#' # Check convergence - values should all be close to 1
#' summary(simmr_out, type = "diagnostics")
#'
#' # Look at output
#' summary(simmr_out, type = "statistics")
#'
#' # Look at influence of priors
#' prior_viz(simmr_out)
#'
#' # Plot output
#' plot(simmr_out, type = "histogram")
#' }
NULL