simmr_load {simmr}R Documentation

Function to load in simmr data and check for errors

Description

This function takes in the mixture data, food source means and standard deviations, and (optionally) correction factor means and standard deviations, and concentration proportions. It performs some (non-exhaustive) checking of the data to make sure it will run through simmr. It outputs an object of class simmr_input.

Usage

simmr_load(
  mixtures,
  source_names,
  source_means,
  source_sds,
  correction_means = NULL,
  correction_sds = NULL,
  concentration_means = NULL,
  group = NULL
)

Arguments

mixtures

The mixture data given as a matrix where the number of rows is the number of observations and the number of columns is the number of tracers (usually isotopes)

source_names

The names of the sources given as a character string

source_means

The means of the source values, given as a matrix where the number of rows is the number of sources and the number of columns is the number of tracers

source_sds

The standard deviations of the source values, given as a matrix where the number of rows is the number of sources and the number of columns is the number of tracers

correction_means

The means of the correction values, given as a matrix where the number of rows is the number of sources and the number of columns is the number of tracers. If not provided these are set to 0.

correction_sds

The standard deviations of the correction values, given as a matrix where the number of rows is the number of sources and the number of columns is the number of tracers. If not provided these are set to 0.

concentration_means

The means of the concentration values, given as a matrix where the number of rows is the number of sources and the number of columns is the number of tracers. These should be between 0 and 1. If not provided these are all set to 1.

group

A grouping variable. These can be a character or factor variable

Details

For standard stable isotope mixture modelling, the mixture matrix will contain a row for each individual and a column for each isotopic value. simmr will allow for any number of isotopes and any number of observations, within computational limits. The source means/sds should be provided for each food source on each isotope. The correction means (usually trophic enrichment factors) can be set as zero if required, and should be of the same shape as the source values. The concentration dependence means should be estimated values of the proportion of each element in the food source in question and should be given in proportion format between 0 and 1. At present there is no means to include concentration standard deviations.

Value

An object of class simmr_input with the following elements:

mixtures

The mixture data

source_neams

Source means

sources_sds

Source standard deviations

correction_means

Correction means

correction_sds

Correction standard deviations

concentration_means

Concentration dependence means

n_obs

The number of observations

n_tracers

The number of tracers/isotopes

n_sources

The number of sources

n_groups

The number of groups

Author(s)

Andrew Parnell <andrew.parnell@mu.ie>

See Also

See simmr_mcmc for complete examples.

Examples


# A simple example with 10 observations, 2 tracers and 4 sources
data(geese_data_day1)
simmr_1 <- 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
  )
)

print(simmr_1)

[Package simmr version 0.5.1.216 Index]