Title: | Stable Isotope Mixing Model |
---|---|
Description: | Estimates diet contributions from isotopic sources using JAGS. Includes estimation of concentration dependence and measurement error. |
Authors: | Jake Ferguson and Jack Hopkins |
Maintainer: | Jake Ferguson <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.5.4 |
Built: | 2024-11-16 06:29:58 UTC |
Source: | CRAN |
The IsotopeR package is a mixing model for use in estimating diet contributions from food sources. The main functionality of the package is provided through the gui in the function IsotopeR. Other functions in the package are called by this interface, but could also be called by a user.
Package: | IsotopeR |
Type: | Package |
Version: | 0.2-1 |
Date: | 2011-03-31 |
License: GPL (>= 2) LazyLoad: | yes |
Jack Hopkins & Jake Ferguson
Maintainer: Jake Ferguson <[email protected]>
Hopkins, J. B., & Ferguson, J. M. (2012). Estimating the Diets of Animals Using Stable Isotopes and a Comprehensive Bayesian Mixing Model. PLoS ONE, 7(1), 1-13. doi:10.1371/journal.pone.0028478
2 source mixing space plot used to plot the source estimations and the observations or model fits.
Bi.plots(jags.1, X, sources=NA, plot.mix = FALSE, plot.ind.flag = FALSE, me.flag = FALSE, color.plots=TRUE, xlab=NULL, ylab=NULL, xlim=NULL, ylim=NULL)
Bi.plots(jags.1, X, sources=NA, plot.mix = FALSE, plot.ind.flag = FALSE, me.flag = FALSE, color.plots=TRUE, xlab=NULL, ylab=NULL, xlim=NULL, ylim=NULL)
jags.1 |
A jags object, output from the runjags package. |
X |
Isotopic mixture data |
sources |
A matrix including all source information. Should be formatted as a source file as discussed in the IsotopeR vignette. |
plot.mix |
A flag, plots the estimated mixture values, when TRUE (1). If FALSE (0) then the the function plots the observed mixture values. |
plot.ind.flag |
Legacy argument, not currently used. |
me.flag |
Denotes wether to plot the measurement error along with observations. |
color.plots |
Denotes whether plots should be color, or black and white. The user does not have the ability to specify which colors should be used. |
xlab |
A character vector for the x-axis label. If NULL the labels from the mixture file will be used. |
ylab |
A character vector for the y-axis label. If NULL the labels from the mixture file will be used. |
xlim |
The x-axis plot limits. If NULL this will be determined automatically. |
ylim |
The y-axis limits. If NULL this will be determined automatically. |
Jake Ferguson
## Not run: IsotopeR() load(SampleOutput.Rdata) Bi.plots(jags.1=jags.out, X=X) ## End(Not run)
## Not run: IsotopeR() load(SampleOutput.Rdata) Bi.plots(jags.1=jags.out, X=X) ## End(Not run)
Plots the population level proportional source estimates (solid black line), group level and individual level estimates (blue).
curves.plot(jags.1, num.sources, num.chains, color = FALSE, individuals, xlab.vec, num.groups)
curves.plot(jags.1, num.sources, num.chains, color = FALSE, individuals, xlab.vec, num.groups)
jags.1 |
A jags object, output from the runjags package. |
num.sources |
Number of isotopic sources used |
num.chains |
Number of mcmc chains |
color |
Whether to make plots in color |
individuals |
Number of individuals in the sample |
xlab.vec |
The name of dietary sources. |
num.groups |
The number of groups that were estimated. |
Jake Ferguson
## Not run: IsotopeR() load(SampleOutput.Rdata) curves.plot(jags.1=jags.out, num.sources=3, individuals=7) ## End(Not run)
## Not run: IsotopeR() load(SampleOutput.Rdata) curves.plot(jags.1=jags.out, num.sources=3, individuals=7) ## End(Not run)
This runs the gui for running an IsotopeR model using JAGS.
IsotopeR()
IsotopeR()
Jake Hopkins, Jake Ferguson
Hopkins JB III, Ferguson JM (2012) Estimating the Diets of Animals Using Stable Isotopes and a Comprehensive Bayesian Mixing Model. PLoS ONE 7(1)
#to run IsotopeR call ## Not run: IsotopeR() #then follow the gui prompts. #type 'vignette("IsotopeR") for a full tutorial.
#to run IsotopeR call ## Not run: IsotopeR() #then follow the gui prompts. #type 'vignette("IsotopeR") for a full tutorial.
The full JAGS IsotopeR model with group structure. Called by IsotopeR().
The full JAGS IsotopeR model with no group or individual structure. Called by IsotopeR().
The JAGS IsotopeR model with no concentration dependence data. Called by IsotopeR().
The JAGS IsotopeR model with group structure and with no concentration dependence data. Called by IsotopeR().
The JAGS IsotopeR model with no concentration dependence or discrimination error. Called by IsotopeR().
The JAGS IsotopeR model with group structure and with no concentration dependence or discrimination error. Called by IsotopeR().
The JAGS IsotopeR model with no concentration dependence data and no individual level structure. Called by IsotopeR().
The JAGS IsotopeR model with no concentration dependence or measurement error. Called by IsotopeR().
The JAGS IsotopeR model with group structure and with no concentration dependence or measurement error. Called by IsotopeR().
The JAGS IsotopeR model with no concentration dependence, measurement error or discriminination error. Called by IsotopeR().
The JAGS IsotopeR model with group structure and with no concentration dependence, measurement error or discriminination error. Called by IsotopeR().
The JAGS IsotopeR model with no individual or group structure and with no concentration dependence or measurement error. Called by IsotopeR().
The JAGS IsotopeR model with no discrimination error. Called by IsotopeR().
The JAGS IsotopeR model with group structure and with no discrimination error. Called by IsotopeR().
The JAGS IsotopeR model with no measurement error. Called by IsotopeR().
The JAGS IsotopeR model with group structure and with no measurement error. Called by IsotopeR().
The JAGS IsotopeR model with no measurement error or discrimination error. Called by IsotopeR().
The JAGS IsotopeR model with group structure and with no measurement error or discrimination error. Called by IsotopeR().
The JAGS IsotopeR model with no measurement error and no indivual or group structure. Called by IsotopeR().
A wrapper function for IsotopeR. Used to call the gui.
IsoWrapper(Mixtures="Necessary File", Sources="Necessary File", Concentrations="Optional File", Discrimination.Error="Optional File", Measurement.Error="Optional File", output.name="SampleOutput.Rdata", mcmc.chains=3, mcmc.burn=1000, mcmc.chainLength=1000, mcmc.thin=1, plot.observations=TRUE, plot.mixing.estimates=TRUE, plot.dietary.source.contributions=TRUE, color.plots=TRUE, run.parallel=TRUE)
IsoWrapper(Mixtures="Necessary File", Sources="Necessary File", Concentrations="Optional File", Discrimination.Error="Optional File", Measurement.Error="Optional File", output.name="SampleOutput.Rdata", mcmc.chains=3, mcmc.burn=1000, mcmc.chainLength=1000, mcmc.thin=1, plot.observations=TRUE, plot.mixing.estimates=TRUE, plot.dietary.source.contributions=TRUE, color.plots=TRUE, run.parallel=TRUE)
Mixtures |
Isotopic mixture data. The first n columns in this data input file are the isotope values associated with each individual (i.e., consumer), where n is the number of isotopes used in the analysis. The last two columns designate the group and individual assignments. If there is no group structure, then column n+1 will contain a "1" for all individuals. If designating multiple groups, the group identity will be determined by the variable in the column. Individuals in the first group should be designated as "1", the second group as "2" etc. The last column identifies each individual. If you have repeated measures for an individual then individuals with repeated measures will have the same number (e.g., 1, 1, 1, 2, 2, 2...). |
Sources |
Source istope values. Each source is a sample of a consumer's dietary items (may be a sample of the same species or aggregate of species). The first n columns in this data input file are the isotope values associated with each sampled dietary item, where n is the number of isotopes used in the analysis. Isotope values need to be in the same order as the mixture data file (e.g., column 1 in Mixtures and Sources contain delta-13C values). The next column (i.e., n+1) identifies the source to which the sampled dietary item belongs. All entries for samples belonging to the first source should be denoted with integer "1", the second source as "2", etc. The last column identifies which species or taxon (i.e., sub-source) the sampled dietary item belongs within each source. This feature assigns equal weight to each sub-source. |
Concentrations |
The concentration-dependence data. The first n columns in this data input file are the concentration data for each sample, where n is the number of elemental concentrations used in the analysis (e.g., [C], [N]). Columns with elemental concentrations need to match Sources and Mixtures (e.g., column 1 in SourceCD and Sources files contain [C] and delta-13C values, respectively). Column n+1 identifies the source in which the set of concentrations belong. All concentrations belonging to the first source should be denoted with integer "1", the second source as "2", etc. The last column links sampled dietary item concentrations to each sub-source. This feature assigns equal weight to each sub-source's elemental concentrations. |
Discrimination.Error |
Discrimination error data. This data input file contains the standard deviations associated with estimated discrimination factors measured in a controlled diet study. The first n columns in the data file are the standard deviations associated with each controlled diet isotope. The last column gives the source identification of the discrimination factors. |
Measurement.Error |
Data on measurement error associated with mass spectrometry. This data input file contains all isotopic measurements for standards. Isotope values need to be in the same order as other data files (e.g., column 1 in MeasurementError, Mixtures, and Sources files contain delta-13C values). |
output.name |
The name of the .Rdata image file to write the JAGS output to. Will also output a .csv file with the same name containing parameter estimates from the model estimates. |
mcmc.chains |
The number of independent markov chains to be run. |
mcmc.burn |
The length of the chain discarded at the beginning of the run. |
mcmc.chainLength |
The total number of iterations run per chain (includes burnin). |
run.parallel |
This boolean flag determines whether the mcmc chains should be run in parallel (TRUE) or not (FALSE). Parallel chains requires that mcmc.chains is greater than 1 and that the machine running the mcmc has multiple cores. Note that the Deviance Information Criterion (DIC) cannot be reported when chains are run in parallel. |
mcmc.thin |
Thinning rate. Reduces the sample size to every nth iteration. |
plot.observations |
This will make a plot of the mixing space, meaning the estimated sources and source concentrations, along with the mixture observations. If measurement error data is provided, the estimated 95 percent CI's will be displayed. |
plot.mixing.estimates |
This will make a plot of the mixing space, meaning the estimated sources and source concentrations, along with the estimate mixture values along with their estimated 95 percent CI's will be displayed. |
plot.dietary.source.contributions |
Plots the smoothed histograms of the population level diet estimates (black) along with individual level estimates (blue). |
color.plots |
This boolean flag defines whether plots should be made in color (TRUE), or grayscale (FALSE). |
Jake Ferguson
A function for Isotoper that is used to plot output from previous runs of IsotopeR.
load.prev.func(file.name="SampleOutput.Rdata", plot.observations=TRUE, plot.mixing.estimates=TRUE, plot.dietary.source.contributions=TRUE, color.plots=TRUE)
load.prev.func(file.name="SampleOutput.Rdata", plot.observations=TRUE, plot.mixing.estimates=TRUE, plot.dietary.source.contributions=TRUE, color.plots=TRUE)
file.name |
The .Rdata file from a previous run of IsotopeR. |
plot.observations |
This will make a plot of the mixing space, meaning the estimated sources and source concentrations, along with the mixture observations. If measurement error data is provided, the estimated 95 percent CI's will be displayed. |
plot.mixing.estimates |
This will make a plot of the mixing space, meaning the estimated sources and source concentrations, along with the estimate mixture values along with their estimated 95 percent CI's will be displayed. |
plot.dietary.source.contributions |
Plots the smoothed histograms of the population level diet estimates (black) along with individual level estimates (blue). |
color.plots |
The flag defines whether plots should be made in color, or grayscale. |
Jake Ferguson
A mixing space plot used to plot the source estimations and the observations or model fits when the number of isotopes used is 3.
RGL.plots(jags.1, X, sources, plot.mix=FALSE, plot.ind.flag=FALSE, color.plots=FALSE)
RGL.plots(jags.1, X, sources, plot.mix=FALSE, plot.ind.flag=FALSE, color.plots=FALSE)
jags.1 |
A jags object, output from the runjags package. |
X |
Isotopic mixture data |
sources |
A matrix including all source information. Should be formatted as a source file as discussed in the IsotopeR vignette. |
plot.mix |
A flag, plots the estimated mixture values, when TRUE (1). If FALSE (0) then the the function plots the observed mixture values. |
plot.ind.flag |
A flag, plots the observed mixture values, when TRUE (1). |
color.plots |
Denotes whether plots should be color, or greyscale. The user does not have the ability to specify which colors should be used. |
Jake Ferguson
A mixing space plot for 3 or more sources used to plot the source estimations and the observations or model fits.
Tri.plots(jags.1, X, sources=NA, plot.mix = FALSE, plot.ind.flag = FALSE, me.flag = FALSE, color.plots=TRUE, xlab=NULL, ylab=NULL)
Tri.plots(jags.1, X, sources=NA, plot.mix = FALSE, plot.ind.flag = FALSE, me.flag = FALSE, color.plots=TRUE, xlab=NULL, ylab=NULL)
jags.1 |
A jags object, output from the runjags package. |
X |
Isotopic mixture data |
sources |
A matrix including all source information. Should be formatted as a source file as discussed in the IsotopeR vignette. |
plot.mix |
A flag, plots the estimated mixture values, when TRUE (1). If FALSE (0) then the the function plots the observed mixture values. |
plot.ind.flag |
Legacy argument, not currently used. |
me.flag |
Denotes wether to plot the measurement error along with observations. |
color.plots |
Denotes whether plots should be color, or greyscale. The user does not have the ability to specify which colors should be used. |
xlab |
A character vector for the x-axis label. If NULL the labels from the mixture file will be used. |
ylab |
A character vector for the y-axis label. If NULL the labels from the mixture file will be used. |
Jake Ferguson
## Not run: IsotopeR() load(SampleOutput.Rdata) Tri.plots(jags.1=jags.out, X=X) ## End(Not run)
## Not run: IsotopeR() load(SampleOutput.Rdata) Tri.plots(jags.1=jags.out, X=X) ## End(Not run)