prepare_data: preparation of the data

View source: R/prepare_data.R

prepare_dataR Documentation

preparation of the data

Description

prepares the data so that they can be used by jags to fit the model. Depending on the presence of biomasses, trophic effiency... the function detects whether it is an escroc or an escropath model

Usage

prepare_data(
  prior_diet_matrix,
  signature_data,
  LOQ,
  prior_signature_data = NULL,
  prior_delta = NULL,
  biomass = NULL,
  uq = NULL,
  productivity = NULL,
  consumption_rate = NULL,
  trophic_efficiency = NULL,
  catch = NULL,
  input_detritus = NULL
)

Arguments

prior_diet_matrix

a square matrix with similar species as colnames and rownames. Species should be consistent with Species in signature_data and prior_signature_data

signature_data

a data frame. First column should be names species and followning columns should correspond to tracers. Data should be transformed first if required. Left censored data and missing data should be denoted NA

LOQ

a data frame with the same number of rows as signature_data and one column per tracer. Gives the limit of detection of limit of quantification of the corresponding measure

prior_signature_data

a data frame that contains data that can be used to build a prior signature for source species. First column should be names Species and second one tracer. Species and tracers should be consistent with signature_data. Then, the three following columns correpond to the mean signature, the standard deviation and the number of samples.

prior_delta

a table that contains prior on magnification/enrichment of tracers per trophic level. First column contains the name of the tracer, second column contains the mean value and third column the standard deviation

biomass

a table with to set priors for biomasses of species and primary production (PP). First column contains the name of species and PP. Second column stands for the value of the observed biomass and 3rd to the standard error arounnd the observation

uq

a table that stores for each species (first column), the minimum (second column) and maximum values (3rd column) of the prior on the proportion of unassimilated food

productivity

a table that stores for each species (first column), the minimum (second column) and maximum values (3rd column) of the prior on the productivity (production=productivity x biomass)

consumption_rate

a table that stores for each species (first column), the minimum (second column) and maximum values (3rd column) of the prior on the consumption rate (consumption=consumption rate x biomass)

trophic_efficiency

rate a table that stores for each species and PP (1st column), a (second column) and b (3rd column) of the beta prior on trophic efficiency (density x^(a-1)*(1-x)^(b-1)/Beta(a,b))

catch

rate a table that stores for each species and PP (1st column), a (second column) with landings and a third with discards#'

input_detritus

a table with only one row (for Detritus), first column necessarily "Detritus". Next column indicates mean and sd

Value

a named list that contains formatted object that will be used by jags to fit the model

Examples

#importing data
data(prior_diet_matrix)
data(LOQ)
data(prior_signature_data)
prior_delta <- data.frame(tracer=c("X15N","X13C"),mean=c(3,0),sd=c(1,1))

#check that everything is ok
mydata <- prepare_data(prior_diet_matrix,signature_data,
LOQ,prior_signature_data,prior_delta)

Irstea/escroc documentation built on June 18, 2022, 11:22 p.m.