pdr_cost {PoolDilutionR} | R Documentation |
Cost function between observed and predicted pools
Description
Cost function between observed and predicted pools
Usage
pdr_cost(
params,
time,
m,
n,
m_prec,
ap_prec,
P,
k,
pool = "CH4",
frac_P = frac_P_default(pool),
frac_k = frac_k_default(pool),
log_progress = NULL
)
Arguments
params |
Named list holding optimizer-assigned values for parameters |
time |
Vector of numeric time values; first should be zero |
m |
Observed total pool size, same length as time |
n |
Observed pool size of heavy isotope, same length as time |
m_prec |
Instrument precision for pool size, expressed as a standard deviation |
ap_prec |
Instrument precision for atom percent, expressed as a standard deviation |
P |
production rate, unit pool size/unit time |
k |
first-order rate constant for consumption, 1/unit time |
pool |
Name of pool; see |
frac_P |
Fractionation value for production; see |
frac_k |
Fractionation value for consumption; see |
log_progress |
An optional logging function |
Value
Returns a cost metric summarizing the difference between the
predicted and observed m
(total pool size) and AP
(atom percent).
Note
This implements Equations 12-14 from von Fischer and Hedin (2002).
Author(s)
K.A. Morris & B. Bond-Lamberty
Examples
m <- c(10, 8, 6, 5, 4, 3)
n <- c(1, 0.7, 0.6, 0.4, 0.3, 0.2)
pdr_cost(params = list(P = 0.5, k = 0.3), time = 0:5, m, n, m_prec = 0.001, ap_prec = 0.01)