metab.bayesian: Metabolism model based on a bayesian parameter estimation...

View source: R/metab.bayesian.R

metab.bayesianR Documentation

Metabolism model based on a bayesian parameter estimation framework

Description

This function runs the bayesian metabolism model on the supplied gas concentration and other supporting data. This allows for both estimates of metabolism along with uncertainty around the parameters.

Usage

metab.bayesian(do.obs, do.sat, k.gas, z.mix, irr, wtr, priors, ...)

Arguments

do.obs

Vector of dissovled oxygen concentration observations, mg L^-1

do.sat

Vector of dissolved oxygen saturation values based on water temperature. Calculate using o2.at.sat

k.gas

Vector of kGAS values calculated from any of the gas flux models (e.g., k.cole) and converted to kGAS using k600.2.kGAS

z.mix

Vector of mixed-layer depths in meters. To calculate, see ts.meta.depths

irr

Vector of photosynthetically active radiation in micro mols / m^2 / s

wtr

Vector of water temperatures in degrees C. Used in scaling respiration with temperature

priors

Parameter priors supplied as a named numeric vector (example: c("gppMu"=0, "gppSig2"=1E5, "rMu"=0, "rSig2"=1E5, "kSig2"=NA))

...

additional arguments; currently "datetime" is the only recognized argument passed through ...

Value

A list of length 4 with components:

model

the jags model, including posterior draws (see jags)

params

parameter estimates of interest from model (medians)

metab.sd

standard deviation of metabolism estimates

metab

daily metabolism estimates as a data.frame with columns corresponding to

GPP

numeric estimate of Gross Primary Production, mg O2 / L / d

R

numeric estimate of Respiration, mg O2 / L / d

NEP

numeric estimate of Net Ecosystem production, mg O2 / L / d

Author(s)

Ryan Batt, Luke A. Winslow

References

Holtgrieve, Gordon W., Daniel E. Schindler, Trevor a. Branch, and Z. Teresa A'mar. 2010. Simultaneous Quantification of Aquatic Ecosystem Metabolism and Reaeration Using a Bayesian Statistical Model of Oxygen Dynamics. Limnology and Oceanography 55 (3): 1047-1062. doi:10.4319/lo.2010.55.3.1047. http://www.aslo.org/lo/toc/vol_55/issue_3/1047.html.

See Also

metab.mle, metab.bookkeep, metab.kalman

Examples

## Not run: 
library(rLakeAnalyzer)

doobs = load.ts(system.file('extdata',
                           'sparkling.doobs', package="LakeMetabolizer"))
wtr = load.ts(system.file('extdata',
                         'sparkling.wtr', package="LakeMetabolizer"))
wnd = load.ts(system.file('extdata',
                         'sparkling.wnd', package="LakeMetabolizer"))
irr = load.ts(system.file('extdata',
                         'sparkling.par', package="LakeMetabolizer"))

#Subset a day
mod.date = as.POSIXct('2009-07-08', 'GMT')
doobs = doobs[trunc(doobs$datetime, 'day') == mod.date, ]
wtr = wtr[trunc(wtr$datetime, 'day') == mod.date, ]
wnd = wnd[trunc(wnd$datetime, 'day') == mod.date, ]
irr = irr[trunc(irr$datetime, 'day') == mod.date, ]

k600 = k.cole.base(wnd[,2])
k.gas = k600.2.kGAS.base(k600, wtr[,3], 'O2')
do.sat = o2.at.sat(wtr[,1:2], altitude=300)

metab.bayesian(irr=irr[,2], z.mix=rep(1, length(k.gas)),
              do.sat=do.sat[,2], wtr=wtr[,2],
              k.gas=k.gas, do.obs=doobs[,2])

## End(Not run)

LakeMetabolizer documentation built on Nov. 16, 2022, 1:09 a.m.