metab.mle | R Documentation |

Process-error-only model with parameters fitted via maximum likelihood estimation (MLE). This function runs the maximum likelihood metabolism model on the supplied gas concentration and other supporting data.

metab.mle(do.obs, do.sat, k.gas, z.mix, irr, wtr, error.type = "OE", ...)

`do.obs` |
Vector of dissolved oxygen concentration observations, |

`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 |

`wtr` |
Vector of water temperatures in |

`error.type` |
Option specifying if model should assume pure Process Error 'PE' or Observation Error 'OE'. Defaults to observation error 'OE'. |

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

The model has the three parameters, *c1, c2, epsilon*, and has the form

*v=k.gas/z.mix*

*a[t] = c1*irr[t-1] + c2*log(wtr[t-1]) + v[t-1]*do.sat[t-1]*

*beta = exp(-v)*

*do.obs[t] = a[t]/v[t-1] + -exp(-v[t-1])*a[t]/v[t-1] + beta[t-1]*do.obs[t-1] + epsilon[t]*

The above model is used during model fitting, but if gas flux is not integrated between time steps, those equations simplify to the following:

*F[t-1] = k.gas[t-1]*(do.sat[t-1] - do.obs[t-1])/z.mix[t-1]*

*do.obs[t] = do.obs[t-1] + c1*irr[t-1] + c2*log(wtr[t-1]) + F[t-1] + epsilon[t]*

The parameters are fit using maximum likelihood, and the optimization (minimization of the negative log likelihood function) is performed by `optim`

using default settings.

GPP is then calculated as `mean(c1*irr, na.rm=TRUE)*freq`

, where `freq`

is the number of observations per day, as estimated from the typical size between time steps. Thus, generally `freq==length(do.obs)`

.

Similarly, R is calculated as `mean(c2*log(wtr), na.rm=TRUE)*freq`

.

NEP is the sum of GPP and R.

A data.frame with columns corresponding to components of metabolism

- 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*

The maximum likelihood estimates of model parameters can be accessed via `attributes(metab.mle(...))[["params"]]`

Currently, missing values in any arguments will result in an error, so freq must always equal nobs.

Luke A Winslow, Ryan Batt, GLEON Fellows

Hanson, PC, SR Carpenter, N Kimura, C Wu, SP Cornelius, TK Kratz. 2008
*Evaluation of metabolism models for free-water dissolved oxygen in lakes*.
Limnology and Oceanography: Methods 6: 454:465.

Solomon CT, DA Bruesewitz, DC Richardson, KC Rose, MC Van de Bogert, PC Hanson, TK Kratz, B Larget,
R Adrian, B Leroux Babin, CY Chiu, DP Hamilton, EE Gaiser, S Hendricks, V Istvanovics, A Laas, DM O'Donnell,
ML Pace, E Ryder, PA Staehr, T Torgersen, MJ Vanni, KC Weathers, G Zhuw. 2013.
*Ecosystem Respiration: Drivers of Daily Variability and Background Respiration in Lakes around the Globe*.
Limnology and Oceanography 58 (3): 849:866. doi:10.4319/lo.2013.58.3.0849.

metab, metab.bookkeep, metab.ols, metab.kalman, metab.bayesian

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, ] z.mix = ts.thermo.depth(wtr) k600 = k.cole.base(wnd[,2]) k.gas = k600.2.kGAS.base(k600, wtr[,3], 'O2') do.sat = o2.at.sat.base(wtr[,3], altitude=300) metab.mle(doobs[,2], do.sat, k.gas, z.mix[,2], irr[,2], wtr[,3])

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.