objfun: An objective function to minimize for finding optimal window...

View source: R/objfun.R

objfunR Documentation

An objective function to minimize for finding optimal window widths

Description

An objective function to minimize for finding optimal window widths

Usage

objfun(
  metab_obs,
  metab_dtd,
  vls = c("meanPg", "sdPg", "anomPg", "meanRt", "sdRt", "anomRt")
)

Arguments

metab_obs

A metab object estimated the observed dissolved oxygen time series

metab_dtd

A metab object estimated the detided dissolved oxygen time series

vls

chr vector of summary evaluation object to optimize, see details

Details

This function is an attempt to quantify a relative measure of comparison to evaluate metabolism estimates from observed and detided dissolved oxygen time series. It is the sole function that is optimized when identifying window widths that produce "best" detided metabolism estimates. The summary is based on an assumption that a detided estimate provides an improved measure of metabolism following several rules of thumb. Specifically, improved estimates are assumed to have lower anomalies (less negative production and positive respiration values), lower standard deviation, and similar mean values for gross production and respiration between the observed and detided estimates.

The quantification of improved fit is based on a sum of percent differences for the six paired measures for percent anomalous production, percent anomalous respiration, mean production, mean respiration, standard deviation of production, and standard deviation of respiration for the estimates from the observed and detided metabolism. The comparisons of the means are taken as the inverse (1 / mean) such that optimization should attempt to keep the values as similar as possible. The final sum is multiplied by negative one such that the value is to be optimized by minimization, i.e., a lower value indicates improved detiding across all measures.

The function can also quantify a comparison based on different measures supplied by the user. By default, all six measures are used. However, selecting specific measures, such as only optimizing by reducing anomalous values, may be preferred. Changing the argument for vls changes which comparisons are used for the summary value.

Value

A single numeric value indicating the estimate from the objective function

See Also

wtobjfun, winopt

Examples

# estimate a summary value for all six measures
objfun(metab_obs, metab_dtd)

# estimate a summary value for only anomalies
objfun(metab_obs, metab_dtd, vls = c('anomPg', 'anomRt'))

fawda123/WtRegDO documentation built on March 18, 2024, 9:04 p.m.