fit_escroc: Fit the model

View source: R/fit_escroc.R

fit_escrocR Documentation

Fit the model

Description

This is the core funtion of the packages. It fits a model ESCROC or escropath using run.jags and returns an mcmc.list object. ESCROC was described in Ballutaud et al. (2019).

Usage

fit_escroc(
  mydata,
  mymodel,
  burnin = 1000,
  sample = 1000,
  adapt = 1000,
  method = "parallel",
  ...
)

Arguments

mydata

a list as returned by function prepare_data

mymodel

a string describing the model as build by building_model

burnin

number of burnin iterations

sample

number of iterations that will be saved for inference

adapt

number of iterations for adaptive phase, if not sufficient a warning will be thrown

method

methods to parallize the MCMC chains, see run.jags for further details

...

additionnal arguments that will be sent to run.jags

Value

a mcmc.list storing the 3 MCMC

References

Ballutaud, M., Drouineau, H., Carassou, L., Munoz, G., Chevillot, X., Labadie, P., Budzinski, H., Lobry, J., 2019. EStimating Contaminants tRansfers Over Complex food webs (ESCROC): An innovative Bayesian method for estimating POP’s biomagnification in aquatic food webs. Science of The Total Environment 658, 638–649. https://doi.org/10.1016/j.scitotenv.2018.12.058

Examples

#importing data
data(signature_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)

#build the model
mymodel <- building_model(mydata)

#fit the model
myresults <- fit_escroc(mydata, mymodel)

#a summary of the results
library(coda)
summary(myresults)$qua

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