bayesmetab: bayesmetab

Description Usage Arguments Value Author(s) References Examples

View source: R/bayesmetab.R

Description

Estimates single-station whole-stream metabolic rates from diel dissolved oxygen (DO) curves (see Grace et al. 2015).

Usage

1
2
3
4
5
bayesmetab(data.dir, results.dir, interval, n.iter = 20000,
  n.burnin = n.iter * 0.5, K.init = 2, smooth.DO = 0,
  smooth.PAR = FALSE, instant = FALSE, update.chains = TRUE,
  extra.iter = 1, K.est = TRUE, K.meas.mean = 0, K.meas.sd = 4,
  p.est = FALSE, theta.est = FALSE)

Arguments

data.dir

relative or absolute path to the folder containing csv input data files to be read.

results.dir

relative or absolute path to the output folder where results (plots and tables) will be written.

interval

Integer. The time interval in seconds (e.g. 10 minutes = 600 seconds)

n.iter

Integer. Number of MCMC iterations (default = 20000)

n.burnin

Integer. Number of iterations of MCMC chains to delete

K.init

Numeric. Initial value of chains for K (/day). Reasonable estimate aids convergence. (default value = 2)

smooth.DO

Numeric. Proportion of high-frequency fluctuations to filter with fast Fourier transform (default = 0)

smooth.PAR

Logical. Should PAR be smoothed with a moving average? (default = FALSE)

instant

Logical. Should a table of instantaneous rates be written? (default = FALSE)

update.chains

Logical. Should the chains automatically update once if not converged? (default = TRUE)

extra.iter

Numeric. Number of extra iterations to run if chains are not converged, as multiple of n.iter (default = 1 times)

K.est

Logical. Should K be estimated with uninformative priors? (default = TRUE)

K.meas.mean

Numeric. Mean for informed normal prior distribution when K.est = FALSE

K.meas.sd

Numeric. Standard deviation for informed normal prior distribution when K.est = FALSE

p.est

Logical. Should p be estimated? (default = FALSE)

theta.est

Logical. Should theta be estimated? (default = FALSE)

Value

A dataframe and csv file of parameter estimates (mean, SD) and checks of model fit, plots of model fit (see Vignette for details https://github.com/dgiling/BASEmetab/blob/master/vignettes/BASEmetab.pdf).

Author(s)

Darren Giling, Ralph Mac Nally

References

Grace et al. (2015) Fast processing of diel oxygen curves: estimating stream metabolism with BASE (BAyesian Single-station Estimation). Limnology and Oceanography: Methods, 13, 103-114.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
##Link to JAGS
library(R2jags)

##View example data set.
#set path to example data.
data.dir <- system.file("extdata", package = "BASEmetab")
ex.data <- read.csv(file.path(data.dir, "Yallakool_example.csv"))
head(ex.data)
tail(ex.data)

##Run Example.

#set output directory to Output folder in current working directory.
results.dir <- file.path(getwd(), "Output")
if (dir.exists(results.dir)){} else {
dir.create(results.dir)}

#run model.
results <- bayesmetab(data.dir, results.dir, interval=600)

nickbond/BASEmetab documentation built on May 28, 2019, 9:31 a.m.